| ... | @@ -1960,7 +1960,10 @@ fn breakExpr(parent_gz: *GenZir, parent_scope: *Scope, node: Ast.Node.Index) Inn | ... | @@ -1960,7 +1960,10 @@ fn breakExpr(parent_gz: *GenZir, parent_scope: *Scope, node: Ast.Node.Index) Inn |
| 1960 | else | 1960 | else |
| 1961 | .@"break"; | 1961 | .@"break"; |
| 1962 | | 1962 | |
| | 1963 | block_gz.break_count += 1; |
| 1963 | if (rhs == 0) { | 1964 | if (rhs == 0) { |
| | 1965 | _ = try rvalue(parent_gz, block_gz.break_result_info, .void_value, node); |
| | 1966 | |
| 1964 | try genDefers(parent_gz, scope, parent_scope, .normal_only); | 1967 | try genDefers(parent_gz, scope, parent_scope, .normal_only); |
| 1965 | | 1968 | |
| 1966 | // As our last action before the break, "pop" the error trace if needed | 1969 | // As our last action before the break, "pop" the error trace if needed |
| ... | @@ -1970,7 +1973,6 @@ fn breakExpr(parent_gz: *GenZir, parent_scope: *Scope, node: Ast.Node.Index) Inn | ... | @@ -1970,7 +1973,6 @@ fn breakExpr(parent_gz: *GenZir, parent_scope: *Scope, node: Ast.Node.Index) Inn |
| 1970 | _ = try parent_gz.addBreak(break_tag, block_inst, .void_value); | 1973 | _ = try parent_gz.addBreak(break_tag, block_inst, .void_value); |
| 1971 | return Zir.Inst.Ref.unreachable_value; | 1974 | return Zir.Inst.Ref.unreachable_value; |
| 1972 | } | 1975 | } |
| 1973 | block_gz.break_count += 1; | | |
| 1974 | | 1976 | |
| 1975 | const operand = try reachableExpr(parent_gz, parent_scope, block_gz.break_result_info, rhs, node); | 1977 | const operand = try reachableExpr(parent_gz, parent_scope, block_gz.break_result_info, rhs, node); |
| 1976 | const search_index = @intCast(Zir.Inst.Index, astgen.instructions.len); | 1978 | const search_index = @intCast(Zir.Inst.Index, astgen.instructions.len); |
| ... | @@ -6584,6 +6586,9 @@ fn forExpr( | ... | @@ -6584,6 +6586,9 @@ fn forExpr( |
| 6584 | cond_block, | 6586 | cond_block, |
| 6585 | break_tag, | 6587 | break_tag, |
| 6586 | ); | 6588 | ); |
| | 6589 | if (ri.rl.strategy(&loop_scope).tag == .break_void and loop_scope.break_count == 0) { |
| | 6590 | _ = try rvalue(parent_gz, ri, .void_value, node); |
| | 6591 | } |
| 6587 | if (is_statement) { | 6592 | if (is_statement) { |
| 6588 | _ = try parent_gz.addUnNode(.ensure_result_used, result, node); | 6593 | _ = try parent_gz.addUnNode(.ensure_result_used, result, node); |
| 6589 | } | 6594 | } |
| ... | @@ -8525,16 +8530,6 @@ fn builtinCall( | ... | @@ -8525,16 +8530,6 @@ fn builtinCall( |
| 8525 | } | 8530 | } |
| 8526 | } | 8531 | } |
| 8527 | | 8532 | |
| 8528 | fn simpleNoOpVoid( | | |
| 8529 | gz: *GenZir, | | |
| 8530 | ri: ResultInfo, | | |
| 8531 | node: Ast.Node.Index, | | |
| 8532 | tag: Zir.Inst.Tag, | | |
| 8533 | ) InnerError!Zir.Inst.Ref { | | |
| 8534 | _ = try gz.addNode(tag, node); | | |
| 8535 | return rvalue(gz, ri, .void_value, node); | | |
| 8536 | } | | |
| 8537 | | | |
| 8538 | fn hasDeclOrField( | 8533 | fn hasDeclOrField( |
| 8539 | gz: *GenZir, | 8534 | gz: *GenZir, |
| 8540 | scope: *Scope, | 8535 | scope: *Scope, |