summaryrefslogtreecommitdiff
path: root/parse.c
diff options
context:
space:
mode:
Diffstat (limited to 'parse.c')
-rw-r--r--parse.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/parse.c b/parse.c
index aa6169c..6457dec 100644
--- a/parse.c
+++ b/parse.c
@@ -2154,6 +2154,11 @@ static Status parse_decl(Parser *p, Declaration *d, U16 flags) {
t->token = end; // move to ;
goto ret_false;
}
+ if (e->kind == EXPR_TYPE
+ && e->typeval->kind == TYPE_STRUCT
+ && p->block == NULL) {
+ e->typeval->struc->name = d->idents[0];
+ }
if ((flags & DECL_CAN_END_WITH_SEMICOLON) && end > t->tokens && token_is_kw(end - 1, KW_RBRACE)) {
// allow semicolon to be ommitted, e.g. f ::= fn() {}
} else if (ends_decl(t->token, flags)) {