mirror of
https://github.com/odin-lang/Odin.git
synced 2026-02-27 21:34:59 +00:00
Make compound literals require trailing commas if followed by a newline
This commit is contained in:
@@ -1719,9 +1719,12 @@ 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);
|
||||
isize expr_level = f->expr_level;
|
||||
f->expr_level = 0;
|
||||
if (f->curr_token.kind != Token_CloseBrace) {
|
||||
elems = parse_element_list(f);
|
||||
}
|
||||
f->expr_level = expr_level;
|
||||
Token close = expect_closing(f, Token_CloseBrace, str_lit("compound literal"));
|
||||
|
||||
return ast_compound_lit(f, type, elems, open, close);
|
||||
|
||||
Reference in New Issue
Block a user