diff options
| author | Veikka Tuominen <git@vexu.eu> | 2022-09-09 16:56:59 +0300 |
|---|---|---|
| committer | Veikka Tuominen <git@vexu.eu> | 2022-09-15 00:48:47 +0300 |
| commit | bf4a3df9a961e18a258d94fa35b0c433424e4bbe (patch) | |
| tree | 809407bceeb4b385204a13322b0430388801855e /src/Sema.zig | |
| parent | 002260c27481e50c74dbb3d8998cf8c3b1c472d8 (diff) | |
| download | zig-bf4a3df9a961e18a258d94fa35b0c433424e4bbe.tar.gz zig-bf4a3df9a961e18a258d94fa35b0c433424e4bbe.zip | |
Sema: allow runtime break from inline loop
Closes #12787
Diffstat (limited to 'src/Sema.zig')
| -rw-r--r-- | src/Sema.zig | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/Sema.zig b/src/Sema.zig index 53617950ed..71dcfef513 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -1353,6 +1353,8 @@ fn analyzeBodyInner( const else_body = sema.code.extra[extra.end + then_body.len ..][0..extra.data.else_body_len]; const cond = try sema.resolveInstConst(block, cond_src, extra.data.condition, "condition in comptime branch must be comptime known"); const inline_body = if (cond.val.toBool()) then_body else else_body; + const old_runtime_index = block.runtime_index; + defer block.runtime_index = old_runtime_index; const break_data = (try sema.analyzeBodyBreak(block, inline_body)) orelse break always_noreturn; if (inst == break_data.block_inst) { |
