Change expr_level increment rules within a compound literal

This commit is contained in:
gingerBill
2021-04-26 23:02:00 +01:00
parent 06e0da97b7
commit c07ab5f9ad

View File

@@ -1719,11 +1719,9 @@ Array<Ast *> parse_element_list(AstFile *f) {
Ast *parse_literal_value(AstFile *f, Ast *type) {
Array<Ast *> elems = {};
Token open = expect_token(f, Token_OpenBrace);
f->expr_level++;
if (f->curr_token.kind != Token_CloseBrace) {
elems = parse_element_list(f);
}
f->expr_level--;
Token close = expect_closing(f, Token_CloseBrace, str_lit("compound literal"));
return ast_compound_lit(f, type, elems, open, close);