aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVeikka Tuominen <git@vexu.eu>2022-03-28 12:23:19 +0300
committerAndrew Kelley <andrew@ziglang.org>2022-03-28 13:05:08 -0700
commita415fe0bc083159cf4bca6984636a564589e9789 (patch)
tree037e4548b04cbdde0eca8d07c3210a83fa1f4dec /src
parent3c4ac47e00d961186c8728df964a29a33275514c (diff)
downloadzig-a415fe0bc083159cf4bca6984636a564589e9789.tar.gz
zig-a415fe0bc083159cf4bca6984636a564589e9789.zip
AstGen: clear rl_ty_inst in setBreakResultLoc if one is not provided
Diffstat (limited to 'src')
-rw-r--r--src/AstGen.zig7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/AstGen.zig b/src/AstGen.zig
index 4141b73e9a..f194270823 100644
--- a/src/AstGen.zig
+++ b/src/AstGen.zig
@@ -2731,6 +2731,7 @@ fn varDecl(
};
resolve_inferred_alloc = alloc;
init_scope.rl_ptr = alloc;
+ init_scope.rl_ty_inst = .none;
}
const init_result_loc: ResultLoc = .{ .block_ptr = &init_scope };
const init_inst = try reachableExpr(&init_scope, &init_scope.base, init_result_loc, var_decl.ast.init_node, node);
@@ -4860,7 +4861,7 @@ fn orelseCatchExpr(
// block_scope unstacked now, can add new instructions to parent_gz
try parent_gz.instructions.append(astgen.gpa, block);
- var then_scope = parent_gz.makeSubBlock(scope);
+ var then_scope = block_scope.makeSubBlock(scope);
defer then_scope.unstack();
// This could be a pointer or value depending on `unwrap_op`.
@@ -4870,7 +4871,7 @@ fn orelseCatchExpr(
else => try rvalue(&then_scope, block_scope.break_result_loc, unwrapped_payload, node),
};
- var else_scope = parent_gz.makeSubBlock(scope);
+ var else_scope = block_scope.makeSubBlock(scope);
defer else_scope.unstack();
var err_val_scope: Scope.LocalVal = undefined;
@@ -9850,10 +9851,12 @@ const GenZir = struct {
},
.discard, .none, .ptr, .ref => {
+ gz.rl_ty_inst = .none;
gz.break_result_loc = parent_rl;
},
.inferred_ptr => |ptr| {
+ gz.rl_ty_inst = .none;
gz.rl_ptr = ptr;
gz.break_result_loc = .{ .block_ptr = gz };
},