From: Brendan Hansen Date: Thu, 9 Jun 2022 01:52:38 +0000 (-0500) Subject: struct parsing change; changed implicit struct X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=704875c2539c2ac7303bb2a516e4e0b1251bcda0;p=onyx.git struct parsing change; changed implicit struct --- diff --git a/src/parser.c b/src/parser.c index 2b22d7aa..4c59577c 100644 --- a/src/parser.c +++ b/src/parser.c @@ -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; diff --git a/src/types.c b/src/types.c index 76ab2661..50d59292 100644 --- a/src/types.c +++ b/src/types.c @@ -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;