diff options
Diffstat (limited to 'src/ir.cpp')
| -rw-r--r-- | src/ir.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/ir.cpp b/src/ir.cpp index c6c50182b..627985857 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -8239,7 +8239,8 @@ void ir_build_stmt_internal(irProcedure *proc, Ast *node) { case_ast_node(is, IfStmt, node); ir_emit_comment(proc, str_lit("IfStmt")); - ir_open_scope(proc); // Open scope here + ir_open_scope(proc); // Scope #1 + defer (ir_close_scope(proc, irDeferExit_Default, nullptr)); if (is->init != nullptr) { // TODO(bill): Should this have a separate block to begin with? @@ -8265,7 +8266,6 @@ void ir_build_stmt_internal(irProcedure *proc, Ast *node) { } ir_build_stmt(proc, is->body); - ir_close_scope(proc, irDeferExit_Default, nullptr); ir_emit_jump(proc, done); @@ -8906,6 +8906,8 @@ void ir_end_procedure_body(irProcedure *proc) { ir_emit_unreachable(proc); } + GB_ASSERT(proc->scope_index == 0); + proc->curr_block = proc->decl_block; ir_emit_jump(proc, proc->entry_block); proc->curr_block = nullptr; |