mirror of
https://github.com/ziglang/zig.git
synced 2026-02-05 06:03:38 +00:00
AstGen: fix ZIR for for loops accessing instruction out of block
This commit is contained in:
parent
8c96d0dddd
commit
209e83f395
@ -6413,6 +6413,8 @@ fn forExpr(
|
||||
defer loop_scope.unstack();
|
||||
defer loop_scope.labeled_breaks.deinit(gpa);
|
||||
|
||||
const index = try loop_scope.addUnNode(.load, index_ptr, node);
|
||||
|
||||
var cond_scope = parent_gz.makeSubBlock(&loop_scope.base);
|
||||
defer cond_scope.unstack();
|
||||
|
||||
@ -6420,7 +6422,6 @@ fn forExpr(
|
||||
if (!any_len_checks) {
|
||||
return astgen.failNode(node, "TODO: handle infinite for loop", .{});
|
||||
}
|
||||
const index = try cond_scope.addUnNode(.load, index_ptr, node);
|
||||
const cond = try cond_scope.addPlNode(.cmp_lt, node, Zir.Inst.Bin{
|
||||
.lhs = index,
|
||||
.rhs = len,
|
||||
@ -10695,7 +10696,6 @@ const Scope = struct {
|
||||
@"function parameter",
|
||||
@"local constant",
|
||||
@"local variable",
|
||||
@"loop index capture",
|
||||
@"switch tag capture",
|
||||
capture,
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user