From: Brendan Hansen Date: Tue, 15 Dec 2020 20:17:21 +0000 (-0600) Subject: updated fun visualization; added check for struct literals X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=a94c9558b3735eb03234b0c89693dc62f9a1af44;p=onyx.git updated fun visualization; added check for struct literals --- diff --git a/onyx b/onyx index 94c832ab..3ab3d1fe 100755 Binary files a/onyx and b/onyx differ diff --git a/src/onyx.c b/src/onyx.c index ff2a5e39..91a65556 100644 --- a/src/onyx.c +++ b/src/onyx.c @@ -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; diff --git a/src/onyxsymres.c b/src/onyxsymres.c index 8c952926..d116a9ca 100644 --- a/src/onyxsymres.c +++ b/src/onyxsymres.c @@ -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;