Disable constants inside structures

This commit is contained in:
Krzosa Karol
2022-09-27 10:26:33 +02:00
parent fef98220ba
commit 3dd9fae080
3 changed files with 46 additions and 45 deletions

View File

@@ -659,12 +659,13 @@ parse_struct(Token *pos){
token_match(OPEN_SCOPE);
Ast_Scope *scope = begin_decl_scope(scratch, token_get());
do{
Token *token = token_get();
Ast_Decl *decl = parse_decl(false);
if(!decl) compiler_error(token, "Failed to parse struct member");
Token *token = token_expect(TK_Identifier);
token_expect(TK_Colon);
Ast_Expr *typespec = parse_expr();
Ast_Decl *decl = ast_var(token, typespec, token->intern_val, 0);
decl->flags = set_flag(decl->flags, AST_AGGREGATE_CHILD);
scope->decls.add(decl);
}while(token_match(SAME_SCOPE));