aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2018-12-17 11:36:15 +0000
committergingerBill <bill@gingerbill.org>2018-12-17 11:36:15 +0000
commit68384a452fc04ee3e7970f979eb6f3b489aab142 (patch)
tree7108e1dbc5844e9de00ea00b21be4a20d1069da3 /src
parent34b6486361db1c0d4eb53821f857df28cc7acf40 (diff)
Fix scoping determination for IR
Diffstat (limited to 'src')
-rw-r--r--src/ir.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/ir.cpp b/src/ir.cpp
index 9ddc182c5..47661c6e3 100644
--- a/src/ir.cpp
+++ b/src/ir.cpp
@@ -8149,6 +8149,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
+
if (is->init != nullptr) {
// TODO(bill): Should this have a separate block to begin with?
#if 1
@@ -8172,7 +8174,6 @@ void ir_build_stmt_internal(irProcedure *proc, Ast *node) {
ir_push_target_list(proc, is->label, done, nullptr, nullptr);
}
- ir_open_scope(proc);
ir_build_stmt(proc, is->body);
ir_close_scope(proc, irDeferExit_Default, nullptr);
@@ -8193,6 +8194,7 @@ void ir_build_stmt_internal(irProcedure *proc, Ast *node) {
case_ast_node(fs, ForStmt, node);
ir_emit_comment(proc, str_lit("ForStmt"));
+ ir_open_scope(proc); // Open Scope here
if (fs->init != nullptr) {
#if 1
@@ -8224,7 +8226,6 @@ void ir_build_stmt_internal(irProcedure *proc, Ast *node) {
ir_push_target_list(proc, fs->label, done, post, nullptr);
- ir_open_scope(proc);
ir_build_stmt(proc, fs->body);
ir_close_scope(proc, irDeferExit_Default, nullptr);
@@ -8244,6 +8245,7 @@ void ir_build_stmt_internal(irProcedure *proc, Ast *node) {
case_ast_node(rs, RangeStmt, node);
ir_emit_comment(proc, str_lit("RangeStmt"));
+ ir_open_scope(proc); // Open scope here
Type *val0_type = nullptr;
Type *val1_type = nullptr;
@@ -8362,7 +8364,6 @@ void ir_build_stmt_internal(irProcedure *proc, Ast *node) {
ir_push_target_list(proc, rs->label, done, loop, nullptr);
- ir_open_scope(proc);
ir_build_stmt(proc, rs->body);
ir_close_scope(proc, irDeferExit_Default, nullptr);
@@ -8477,7 +8478,6 @@ void ir_build_stmt_internal(irProcedure *proc, Ast *node) {
ir_close_scope(proc, irDeferExit_Default, default_block);
ir_pop_target_list(proc);
}
-
ir_emit_jump(proc, done);
ir_start_block(proc, done);
case_end;