random little changes
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Sat, 2 Jan 2021 04:06:12 +0000 (22:06 -0600)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Sat, 2 Jan 2021 04:06:12 +0000 (22:06 -0600)
misc/onyx.sublime-syntax
src/onyxutils.c
src/onyxwasm.c

index 3ef2281347571fb441070168b991b5cf75236414..bb27b1447436cfe9afc04cd74548c456a2edf6ae 100644 (file)
@@ -48,6 +48,18 @@ contexts:
     - match: '#[a-zA-Z_]+'
       scope: keyword.other.onyx
 
+    - match: '([a-zA-Z_][a-zA-Z0-9_]*)\s*::\s*proc'
+      captures:
+        1: entity.name.function
+
+    - match: '([a-zA-Z_][a-zA-Z0-9_]*)\s*::\s*struct'
+      captures:
+        1: entity.name.struct
+
+    - match: '([a-zA-Z_][a-zA-Z0-9_]*)\s*::\s*enum'
+      captures:
+        1: entity.name.enum
+
     - match: '([a-zA-Z_][a-zA-Z0-9_\.]+)\s*\('
       captures:
         1: meta.function-call.onyx
index 132a43ccd815263852ec4fd7bc8edb493844da42..ace28bbe647b0a40058fa2f98c154cbfa16fd58a 100644 (file)
@@ -929,10 +929,8 @@ b32 type_check_or_auto_cast(AstTyped** pnode, Type* type) {
 
     if (types_are_compatible(node->type, type)) return 1;
     if (node_is_auto_cast((AstNode *) node)) {
-        // If the node is an auto cast, we convert it to a cast node which will reports errors if
-        // the cast is illegal in the code generation.
+        // HACK: Check that this cast is legal!
         ((AstUnaryOp *) node)->type = type;
-        // ((AstUnaryOp *) node)->operation = Unary_Op_Cast;
         return 1;
     }
     else if (node->kind == Ast_Kind_NumLit) {
index a563d589de751785ab510c08b38ee33bd1e11808..ebed5db1fdcfd203aaa9bd60f4a3205aca7e595c 100644 (file)
@@ -1366,10 +1366,8 @@ EMIT_FUNC(unaryop, AstUnaryOp* unop) {
             break;
         }
 
+        case Unary_Op_Auto_Cast:
         case Unary_Op_Cast: emit_cast(mod, &code, unop); break;
-
-        // NOTE: Any remaining auto casts can be ignored since it means that a cast was not necessary. - brendanfh 2020/09/19
-        case Unary_Op_Auto_Cast: emit_cast(mod, &code, unop); break;
     }
 
     *pcode = code;