| ... | @@ -1801,7 +1801,10 @@ fn breakExpr(parent_gz: *GenZir, parent_scope: *Scope, node: Ast.Node.Index) Inn | ... | @@ -1801,7 +1801,10 @@ fn breakExpr(parent_gz: *GenZir, parent_scope: *Scope, node: Ast.Node.Index) Inn |
| 1801 | continue; | 1801 | continue; |
| 1802 | }; | 1802 | }; |
| 1803 | | 1803 | |
| 1804 | const break_tag: Zir.Inst.Tag = if (block_gz.is_inline) .break_inline else .@"break"; | 1804 | const break_tag: Zir.Inst.Tag = if (block_gz.is_inline or block_gz.force_comptime) |
| | 1805 | .break_inline |
| | 1806 | else |
| | 1807 | .@"break"; |
| 1805 | | 1808 | |
| 1806 | if (rhs == 0) { | 1809 | if (rhs == 0) { |
| 1807 | _ = try parent_gz.addBreak(break_tag, block_inst, .void_value); | 1810 | _ = try parent_gz.addBreak(break_tag, block_inst, .void_value); |
| ... | @@ -1887,7 +1890,10 @@ fn continueExpr(parent_gz: *GenZir, parent_scope: *Scope, node: Ast.Node.Index) | ... | @@ -1887,7 +1890,10 @@ fn continueExpr(parent_gz: *GenZir, parent_scope: *Scope, node: Ast.Node.Index) |
| 1887 | continue; | 1890 | continue; |
| 1888 | } | 1891 | } |
| 1889 | | 1892 | |
| 1890 | const break_tag: Zir.Inst.Tag = if (gen_zir.is_inline) .break_inline else .@"break"; | 1893 | const break_tag: Zir.Inst.Tag = if (gen_zir.is_inline or gen_zir.force_comptime) |
| | 1894 | .break_inline |
| | 1895 | else |
| | 1896 | .@"break"; |
| 1891 | _ = try parent_gz.addBreak(break_tag, continue_block, .void_value); | 1897 | _ = try parent_gz.addBreak(break_tag, continue_block, .void_value); |
| 1892 | return Zir.Inst.Ref.unreachable_value; | 1898 | return Zir.Inst.Ref.unreachable_value; |
| 1893 | }, | 1899 | }, |
| ... | @@ -1993,7 +1999,8 @@ fn labeledBlockExpr( | ... | @@ -1993,7 +1999,8 @@ fn labeledBlockExpr( |
| 1993 | | 1999 | |
| 1994 | // Reserve the Block ZIR instruction index so that we can put it into the GenZir struct | 2000 | // Reserve the Block ZIR instruction index so that we can put it into the GenZir struct |
| 1995 | // so that break statements can reference it. | 2001 | // so that break statements can reference it. |
| 1996 | const block_inst = try gz.makeBlockInst(.block, block_node); | 2002 | const block_tag: Zir.Inst.Tag = if (gz.force_comptime) .block_inline else .block; |
| | 2003 | const block_inst = try gz.makeBlockInst(block_tag, block_node); |
| 1997 | try gz.instructions.append(astgen.gpa, block_inst); | 2004 | try gz.instructions.append(astgen.gpa, block_inst); |
| 1998 | | 2005 | |
| 1999 | var block_scope = gz.makeSubBlock(parent_scope); | 2006 | var block_scope = gz.makeSubBlock(parent_scope); |
| ... | @@ -2007,7 +2014,8 @@ fn labeledBlockExpr( | ... | @@ -2007,7 +2014,8 @@ fn labeledBlockExpr( |
| 2007 | | 2014 | |
| 2008 | try blockExprStmts(&block_scope, &block_scope.base, statements); | 2015 | try blockExprStmts(&block_scope, &block_scope.base, statements); |
| 2009 | if (!block_scope.endsWithNoReturn()) { | 2016 | if (!block_scope.endsWithNoReturn()) { |
| 2010 | _ = try block_scope.addBreak(.@"break", block_inst, .void_value); | 2017 | const break_tag: Zir.Inst.Tag = if (block_scope.force_comptime) .break_inline else .@"break"; |
| | 2018 | _ = try block_scope.addBreak(break_tag, block_inst, .void_value); |
| 2011 | } | 2019 | } |
| 2012 | | 2020 | |
| 2013 | if (!block_scope.label.?.used) { | 2021 | if (!block_scope.label.?.used) { |
| ... | @@ -4833,6 +4841,7 @@ fn tryExpr( | ... | @@ -4833,6 +4841,7 @@ fn tryExpr( |
| 4833 | try genDefers(&else_scope, &fn_block.base, scope, .{ .both = err_code }); | 4841 | try genDefers(&else_scope, &fn_block.base, scope, .{ .both = err_code }); |
| 4834 | const else_result = try else_scope.addUnNode(.ret_node, err_code, node); | 4842 | const else_result = try else_scope.addUnNode(.ret_node, err_code, node); |
| 4835 | | 4843 | |
| | 4844 | const break_tag: Zir.Inst.Tag = if (parent_gz.force_comptime) .break_inline else .@"break"; |
| 4836 | return finishThenElseBlock( | 4845 | return finishThenElseBlock( |
| 4837 | parent_gz, | 4846 | parent_gz, |
| 4838 | rl, | 4847 | rl, |
| ... | @@ -4846,7 +4855,7 @@ fn tryExpr( | ... | @@ -4846,7 +4855,7 @@ fn tryExpr( |
| 4846 | else_result, | 4855 | else_result, |
| 4847 | block, | 4856 | block, |
| 4848 | block, | 4857 | block, |
| 4849 | .@"break", | 4858 | break_tag, |
| 4850 | ); | 4859 | ); |
| 4851 | } | 4860 | } |
| 4852 | | 4861 | |
| ... | @@ -4928,6 +4937,7 @@ fn orelseCatchExpr( | ... | @@ -4928,6 +4937,7 @@ fn orelseCatchExpr( |
| 4928 | // instructions into place until we know whether to keep store_to_block_ptr | 4937 | // instructions into place until we know whether to keep store_to_block_ptr |
| 4929 | // instructions or not. | 4938 | // instructions or not. |
| 4930 | | 4939 | |
| | 4940 | const break_tag: Zir.Inst.Tag = if (parent_gz.force_comptime) .break_inline else .@"break"; |
| 4931 | return finishThenElseBlock( | 4941 | return finishThenElseBlock( |
| 4932 | parent_gz, | 4942 | parent_gz, |
| 4933 | rl, | 4943 | rl, |
| ... | @@ -4941,7 +4951,7 @@ fn orelseCatchExpr( | ... | @@ -4941,7 +4951,7 @@ fn orelseCatchExpr( |
| 4941 | else_result, | 4951 | else_result, |
| 4942 | block, | 4952 | block, |
| 4943 | block, | 4953 | block, |
| 4944 | .@"break", | 4954 | break_tag, |
| 4945 | ); | 4955 | ); |
| 4946 | } | 4956 | } |
| 4947 | | 4957 | |
| ... | @@ -5306,6 +5316,7 @@ fn ifExpr( | ... | @@ -5306,6 +5316,7 @@ fn ifExpr( |
| 5306 | .result = .none, | 5316 | .result = .none, |
| 5307 | }; | 5317 | }; |
| 5308 | | 5318 | |
| | 5319 | const break_tag: Zir.Inst.Tag = if (parent_gz.force_comptime) .break_inline else .@"break"; |
| 5309 | return finishThenElseBlock( | 5320 | return finishThenElseBlock( |
| 5310 | parent_gz, | 5321 | parent_gz, |
| 5311 | rl, | 5322 | rl, |
| ... | @@ -5319,7 +5330,7 @@ fn ifExpr( | ... | @@ -5319,7 +5330,7 @@ fn ifExpr( |
| 5319 | else_info.result, | 5330 | else_info.result, |
| 5320 | block, | 5331 | block, |
| 5321 | block, | 5332 | block, |
| 5322 | .@"break", | 5333 | break_tag, |
| 5323 | ); | 5334 | ); |
| 5324 | } | 5335 | } |
| 5325 | | 5336 | |