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