Core: Add defer
This commit is contained in:
@@ -271,7 +271,7 @@ parse_optional_type() {
|
||||
return result;
|
||||
}
|
||||
|
||||
CORE_Static Ast_Scope *parse_stmt_scope(Ast_Scope *scope_defined_outside = 0, bool empty_scope_is_error = true);
|
||||
CORE_Static Ast_Scope *parse_stmt_scope(Ast_Scope *scope_defined_outside = 0);
|
||||
|
||||
CORE_Static Ast *
|
||||
parse_stmt() {
|
||||
@@ -479,7 +479,7 @@ parse_stmt() {
|
||||
}
|
||||
|
||||
CORE_Static Ast_Scope *
|
||||
parse_stmt_scope(Ast_Scope *scope_defined_outside, bool empty_scope_is_error) {
|
||||
parse_stmt_scope(Ast_Scope *scope_defined_outside) {
|
||||
Scoped_Arena scratch(pctx->scratch);
|
||||
Ast_Scope *scope = scope_defined_outside;
|
||||
if (!scope_defined_outside) scope = begin_stmt_scope(scratch.arena, token_get());
|
||||
@@ -488,6 +488,7 @@ parse_stmt_scope(Ast_Scope *scope_defined_outside, bool empty_scope_is_error) {
|
||||
do {
|
||||
Ast *stmt = parse_stmt();
|
||||
scope->stmts.add(stmt);
|
||||
if (stmt->kind == AST_DEFER) scope->defers.add((Ast_Defer *)stmt);
|
||||
} while (token_match(SAME_SCOPE));
|
||||
token_expect(CLOSE_SCOPE);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user