updated fun visualization; added check for struct literals
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Tue, 15 Dec 2020 20:17:21 +0000 (14:17 -0600)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Tue, 15 Dec 2020 20:17:21 +0000 (14:17 -0600)
onyx
src/onyx.c
src/onyxsymres.c

diff --git a/onyx b/onyx
index 94c832ab05734d7bc5c97efd80903e7982e9517c..3ab3d1fe845ee35d72303fb71c63f006820eefe0 100755 (executable)
Binary files a/onyx and b/onyx differ
index ff2a5e39d7ff4da2ee3f77ca10ba10acbaee8f1b..91a65556e18e8f647e011d58bff72169ca5dc08d 100644 (file)
@@ -455,7 +455,7 @@ static void output_dummy_progress_bar(CompilerState* compiler_state) {
         printf("%20s (%4d) | ", entity_state_strings[i], eh->state_count[i]);
         
         printf("\e[0K");
-        for (i32 c = 0; c < eh->state_count[i] / 10; c++) printf("\xe2\x96\x88");
+        for (i32 c = 0; c < eh->state_count[i] * 50 / bh_arr_length(eh->entities); c++) printf("\xe2\x96\x88");
         printf("\n");
     }
 }
@@ -497,7 +497,7 @@ static i32 onyx_compile(CompilerState* compiler_state) {
             output_dummy_progress_bar(compiler_state);
 
             // Slowing things down for the effect
-            usleep(2000);
+            usleep(1000);
 
             if (ent.expr->token) {
                 OnyxFilePos pos = ent.expr->token->pos;
index 8c952926b0cebc898b4b3249cdb36c4d63c803db..d116a9caa403b9fca2b285a993ef3a02bf0dfbac 100644 (file)
@@ -286,6 +286,11 @@ static void symres_unaryop(AstUnaryOp** unaryop) {
 static void symres_struct_literal(AstStructLiteral* sl) {
     // @CLEANUP
     if (sl->stnode != NULL) symres_expression(&sl->stnode);
+    if (!node_is_type((AstNode *) sl->stnode)) {
+        onyx_report_error(sl->token->pos, "Struct type is not a type.");
+        return;
+    }
+
     sl->stnode = (AstTyped *) symres_type((AstType *) sl->stnode);
     if (sl->stnode == NULL || sl->stnode->kind == Ast_Kind_Error || sl->stnode->kind == Ast_Kind_Symbol) return;