mirror of
https://github.com/odin-lang/Odin.git
synced 2026-01-08 14:03:14 +00:00
Check for empty generic declaration list
This commit is contained in:
@@ -2567,11 +2567,19 @@ AstNode *parse_gen_decl(AstFile *f, Token token, ParseSpecFunc *func) {
|
||||
expect_semicolon(f, spec);
|
||||
}
|
||||
close = expect_token(f, Token_CloseParen);
|
||||
if (f->curr_token.pos.line == close.pos.line ||
|
||||
open.pos.line == close.pos.line) {
|
||||
expect_semicolon(f, NULL);
|
||||
}
|
||||
} else {
|
||||
array_init(&specs, heap_allocator(), 1);
|
||||
array_add(&specs, func(f, token));
|
||||
}
|
||||
|
||||
if (specs.count == 0) {
|
||||
syntax_error(token, "Empty %.*s declaration list", LIT(token_strings[token.kind]));
|
||||
}
|
||||
|
||||
AstNode *decl = ast_gen_decl(f, token, open, close, specs);
|
||||
if (token.kind == Token_let) {
|
||||
decl->GenDecl.flags |= VarDeclFlag_immutable;
|
||||
@@ -2790,7 +2798,6 @@ AstNode *parse_decl(AstFile *f) {
|
||||
|
||||
Token token = f->curr_token;
|
||||
next_token(f);
|
||||
|
||||
return parse_gen_decl(f, token, func);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user