mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
Fix parsing issue with stray } and case at the file scope
This commit is contained in:
+14
-1
@@ -4544,7 +4544,20 @@ bool parse_file(Parser *p, AstFile *f) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
f->decls = parse_stmt_list(f);
|
f->decls = array_make<Ast *>(heap_allocator());
|
||||||
|
|
||||||
|
while (f->curr_token.kind != Token_EOF) {
|
||||||
|
Ast *stmt = parse_stmt(f);
|
||||||
|
if (stmt && stmt->kind != Ast_EmptyStmt) {
|
||||||
|
array_add(&f->decls, stmt);
|
||||||
|
if (stmt->kind == Ast_ExprStmt &&
|
||||||
|
stmt->ExprStmt.expr != nullptr &&
|
||||||
|
stmt->ExprStmt.expr->kind == Ast_ProcLit) {
|
||||||
|
syntax_error(stmt, "Procedure literal evaluated but not used");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
parse_setup_file_decls(p, f, base_dir, f->decls);
|
parse_setup_file_decls(p, f, base_dir, f->decls);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user