| ... | ... | @@ -1729,8 +1729,10 @@ fn breakExpr(parent_gz: *GenZir, parent_scope: *Scope, node: Ast.Node.Index) Inn |
| 1729 | 1729 | continue; |
| 1730 | 1730 | }; |
| 1731 | 1731 | |
| 1732 | const break_tag: Zir.Inst.Tag = if (block_gz.is_inline) .break_inline else .@"break"; |
| 1733 | |
| 1732 | 1734 | if (rhs == 0) { |
| 1733 | | _ = try parent_gz.addBreak(.@"break", block_inst, .void_value); |
| 1735 | _ = try parent_gz.addBreak(break_tag, block_inst, .void_value); |
| 1734 | 1736 | return Zir.Inst.Ref.unreachable_value; |
| 1735 | 1737 | } |
| 1736 | 1738 | block_gz.break_count += 1; |
| ... | ... | @@ -1746,7 +1748,7 @@ fn breakExpr(parent_gz: *GenZir, parent_scope: *Scope, node: Ast.Node.Index) Inn |
| 1746 | 1748 | |
| 1747 | 1749 | switch (block_gz.break_result_loc) { |
| 1748 | 1750 | .block_ptr => { |
| 1749 | | const br = try parent_gz.addBreak(.@"break", block_inst, operand); |
| 1751 | const br = try parent_gz.addBreak(break_tag, block_inst, operand); |
| 1750 | 1752 | try block_gz.labeled_breaks.append(astgen.gpa, br); |
| 1751 | 1753 | |
| 1752 | 1754 | // if list grew as much as rvalue_rl_count, then a break |
| ... | ... | @@ -1765,10 +1767,10 @@ fn breakExpr(parent_gz: *GenZir, parent_scope: *Scope, node: Ast.Node.Index) Inn |
| 1765 | 1767 | .ptr => { |
| 1766 | 1768 | // In this case we don't have any mechanism to intercept it; |
| 1767 | 1769 | // we assume the result location is written, and we break with void. |
| 1768 | | _ = try parent_gz.addBreak(.@"break", block_inst, .void_value); |
| 1770 | _ = try parent_gz.addBreak(break_tag, block_inst, .void_value); |
| 1769 | 1771 | }, |
| 1770 | 1772 | else => { |
| 1771 | | _ = try parent_gz.addBreak(.@"break", block_inst, operand); |
| 1773 | _ = try parent_gz.addBreak(break_tag, block_inst, operand); |
| 1772 | 1774 | }, |
| 1773 | 1775 | } |
| 1774 | 1776 | return Zir.Inst.Ref.unreachable_value; |
| ... | ... | @@ -5300,6 +5302,7 @@ fn whileExpr( |
| 5300 | 5302 | try parent_gz.instructions.append(astgen.gpa, loop_block); |
| 5301 | 5303 | |
| 5302 | 5304 | var loop_scope = parent_gz.makeSubBlock(scope); |
| 5305 | loop_scope.is_inline = is_inline; |
| 5303 | 5306 | loop_scope.setBreakResultLoc(rl); |
| 5304 | 5307 | defer loop_scope.unstack(); |
| 5305 | 5308 | defer loop_scope.labeled_breaks.deinit(astgen.gpa); |
| ... | ... | @@ -5550,6 +5553,7 @@ fn forExpr( |
| 5550 | 5553 | try parent_gz.instructions.append(astgen.gpa, loop_block); |
| 5551 | 5554 | |
| 5552 | 5555 | var loop_scope = parent_gz.makeSubBlock(scope); |
| 5556 | loop_scope.is_inline = is_inline; |
| 5553 | 5557 | loop_scope.setBreakResultLoc(rl); |
| 5554 | 5558 | defer loop_scope.unstack(); |
| 5555 | 5559 | defer loop_scope.labeled_breaks.deinit(astgen.gpa); |
| ... | ... | @@ -9492,6 +9496,8 @@ const GenZir = struct { |
| 9492 | 9496 | const base_tag: Scope.Tag = .gen_zir; |
| 9493 | 9497 | base: Scope = Scope{ .tag = base_tag }, |
| 9494 | 9498 | force_comptime: bool, |
| 9499 | /// This is set to true for inline loops; false otherwise. |
| 9500 | is_inline: bool = false, |
| 9495 | 9501 | in_defer: bool, |
| 9496 | 9502 | c_import: bool = false, |
| 9497 | 9503 | /// How decls created in this scope should be named. |