struct parsing change; changed implicit struct
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Thu, 9 Jun 2022 01:52:38 +0000 (20:52 -0500)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Thu, 9 Jun 2022 01:52:38 +0000 (20:52 -0500)
src/parser.c
src/types.c

index 2b22d7aabc8e025807334f9c55b7bb38f18ab864..4c59577c27d8e9796215f02e38c1749fe6622421 100644 (file)
@@ -2115,7 +2115,9 @@ static AstStructType* parse_struct(OnyxParser* parser) {
             bh_arr_push(s_node->members, mem);
         }
 
-        expect_token(parser, ';');
+        if (peek_token(0)->type != '}') {
+            expect_token(parser, ';');
+        }
     }
 
     if (s_node->scope) parser->current_scope = parser->current_scope->parent;
index 76ab26611d5c3cf3c1d989b1b3a92d0f762633e6..50d592929dc58145f9b835edeb4f6838bb9c425b 100644 (file)
@@ -746,7 +746,7 @@ Type* type_build_implicit_type_of_struct_literal(bh_allocator alloc, AstStructLi
         smem->idx = idx;
         smem->name = bh_strdup(alloc, nv->token->text);
         smem->token = nv->token;
-        smem->initial_value = NULL;
+        smem->initial_value = &nv->value;
         smem->meta_tags = NULL;
         smem->included_through_use = 0;
         smem->used = 0;