| ... | ... | @@ -606,6 +606,21 @@ fn resolveBody( |
| 606 | 606 | return try sema.resolveInst(break_data.operand); |
| 607 | 607 | } |
| 608 | 608 | |
| 609 | fn analyzeBodyRuntimeBreak(sema: *Sema, block: *Block, body: []const Zir.Inst.Index) !void { |
| 610 | _ = sema.analyzeBodyInner(block, body) catch |err| switch (err) { |
| 611 | error.ComptimeBreak => { |
| 612 | const zir_datas = sema.code.instructions.items(.data); |
| 613 | const break_data = zir_datas[sema.comptime_break_inst].@"break"; |
| 614 | try sema.addRuntimeBreak(block, .{ |
| 615 | .block_inst = break_data.block_inst, |
| 616 | .operand = break_data.operand, |
| 617 | .inst = sema.comptime_break_inst, |
| 618 | }); |
| 619 | }, |
| 620 | else => |e| return e, |
| 621 | }; |
| 622 | } |
| 623 | |
| 609 | 624 | pub fn analyzeBody( |
| 610 | 625 | sema: *Sema, |
| 611 | 626 | block: *Block, |
| ... | ... | @@ -10005,18 +10020,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError |
| 10005 | 10020 | if (err_set and try sema.maybeErrorUnwrap(&case_block, body, operand)) { |
| 10006 | 10021 | // nothing to do here |
| 10007 | 10022 | } else if (analyze_body) { |
| 10008 | | _ = sema.analyzeBodyInner(&case_block, body) catch |err| switch (err) { |
| 10009 | | error.ComptimeBreak => { |
| 10010 | | const zir_datas = sema.code.instructions.items(.data); |
| 10011 | | const break_data = zir_datas[sema.comptime_break_inst].@"break"; |
| 10012 | | try sema.addRuntimeBreak(&case_block, .{ |
| 10013 | | .block_inst = break_data.block_inst, |
| 10014 | | .operand = break_data.operand, |
| 10015 | | .inst = sema.comptime_break_inst, |
| 10016 | | }); |
| 10017 | | }, |
| 10018 | | else => |e| return e, |
| 10019 | | }; |
| 10023 | try sema.analyzeBodyRuntimeBreak(&case_block, body); |
| 10020 | 10024 | } else { |
| 10021 | 10025 | _ = try case_block.addNoOp(.unreach); |
| 10022 | 10026 | } |
| ... | ... | @@ -10069,16 +10073,16 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError |
| 10069 | 10073 | extra_index += 1; |
| 10070 | 10074 | |
| 10071 | 10075 | const item_first_ref = try sema.resolveInst(first_ref); |
| 10072 | | var item_first = sema.resolveConstValue(block, .unneeded, item_first_ref, undefined) catch unreachable; |
| 10076 | var item = sema.resolveConstValue(block, .unneeded, item_first_ref, undefined) catch unreachable; |
| 10073 | 10077 | const item_last_ref = try sema.resolveInst(last_ref); |
| 10074 | 10078 | const item_last = sema.resolveConstValue(block, .unneeded, item_last_ref, undefined) catch unreachable; |
| 10075 | 10079 | |
| 10076 | | while (item_first.compare(.lte, item_last, operand_ty, sema.mod)) : ({ |
| 10077 | | item_first = try sema.intAddScalar(block, case_src, item_first, Value.one); |
| 10080 | while (item.compare(.lte, item_last, operand_ty, sema.mod)) : ({ |
| 10081 | item = try sema.intAddScalar(block, case_src, item, Value.one); |
| 10078 | 10082 | }) { |
| 10079 | 10083 | cases_len += 1; |
| 10080 | 10084 | |
| 10081 | | const item_ref = try sema.addConstant(operand_ty, item_first); |
| 10085 | const item_ref = try sema.addConstant(operand_ty, item); |
| 10082 | 10086 | case_block.inline_case_capture = item_ref; |
| 10083 | 10087 | |
| 10084 | 10088 | case_block.instructions.shrinkRetainingCapacity(0); |
| ... | ... | @@ -10087,25 +10091,12 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError |
| 10087 | 10091 | if (emit_bb) try sema.emitBackwardBranch(block, case_src); |
| 10088 | 10092 | emit_bb = true; |
| 10089 | 10093 | |
| 10090 | | _ = sema.analyzeBodyInner(&case_block, body) catch |err| switch (err) { |
| 10091 | | error.ComptimeBreak => { |
| 10092 | | const zir_datas = sema.code.instructions.items(.data); |
| 10093 | | const break_data = zir_datas[sema.comptime_break_inst].@"break"; |
| 10094 | | try sema.addRuntimeBreak(&case_block, .{ |
| 10095 | | .block_inst = break_data.block_inst, |
| 10096 | | .operand = break_data.operand, |
| 10097 | | .inst = sema.comptime_break_inst, |
| 10098 | | }); |
| 10099 | | }, |
| 10100 | | else => |e| return e, |
| 10101 | | }; |
| 10102 | | |
| 10103 | | // try wip_captures.finalize(); |
| 10094 | try sema.analyzeBodyRuntimeBreak(&case_block, body); |
| 10104 | 10095 | |
| 10105 | 10096 | try cases_extra.ensureUnusedCapacity(gpa, 3 + case_block.instructions.items.len); |
| 10106 | 10097 | cases_extra.appendAssumeCapacity(1); // items_len |
| 10107 | 10098 | cases_extra.appendAssumeCapacity(@intCast(u32, case_block.instructions.items.len)); |
| 10108 | | cases_extra.appendAssumeCapacity(@enumToInt(item_ref)); |
| 10099 | cases_extra.appendAssumeCapacity(@enumToInt(case_block.inline_case_capture)); |
| 10109 | 10100 | cases_extra.appendSliceAssumeCapacity(case_block.instructions.items); |
| 10110 | 10101 | } |
| 10111 | 10102 | } |
| ... | ... | @@ -10129,28 +10120,15 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError |
| 10129 | 10120 | emit_bb = true; |
| 10130 | 10121 | |
| 10131 | 10122 | if (analyze_body) { |
| 10132 | | _ = sema.analyzeBodyInner(&case_block, body) catch |err| switch (err) { |
| 10133 | | error.ComptimeBreak => { |
| 10134 | | const zir_datas = sema.code.instructions.items(.data); |
| 10135 | | const break_data = zir_datas[sema.comptime_break_inst].@"break"; |
| 10136 | | try sema.addRuntimeBreak(&case_block, .{ |
| 10137 | | .block_inst = break_data.block_inst, |
| 10138 | | .operand = break_data.operand, |
| 10139 | | .inst = sema.comptime_break_inst, |
| 10140 | | }); |
| 10141 | | }, |
| 10142 | | else => |e| return e, |
| 10143 | | }; |
| 10123 | try sema.analyzeBodyRuntimeBreak(&case_block, body); |
| 10144 | 10124 | } else { |
| 10145 | 10125 | _ = try case_block.addNoOp(.unreach); |
| 10146 | 10126 | } |
| 10147 | 10127 | |
| 10148 | | // try wip_captures.finalize(); |
| 10149 | | |
| 10150 | 10128 | try cases_extra.ensureUnusedCapacity(gpa, 3 + case_block.instructions.items.len); |
| 10151 | 10129 | cases_extra.appendAssumeCapacity(1); // items_len |
| 10152 | 10130 | cases_extra.appendAssumeCapacity(@intCast(u32, case_block.instructions.items.len)); |
| 10153 | | cases_extra.appendAssumeCapacity(@enumToInt(item)); |
| 10131 | cases_extra.appendAssumeCapacity(@enumToInt(case_block.inline_case_capture)); |
| 10154 | 10132 | cases_extra.appendSliceAssumeCapacity(case_block.instructions.items); |
| 10155 | 10133 | } |
| 10156 | 10134 | |
| ... | ... | @@ -10181,18 +10159,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError |
| 10181 | 10159 | if (err_set and try sema.maybeErrorUnwrap(&case_block, body, operand)) { |
| 10182 | 10160 | // nothing to do here |
| 10183 | 10161 | } else if (analyze_body) { |
| 10184 | | _ = sema.analyzeBodyInner(&case_block, body) catch |err| switch (err) { |
| 10185 | | error.ComptimeBreak => { |
| 10186 | | const zir_datas = sema.code.instructions.items(.data); |
| 10187 | | const break_data = zir_datas[sema.comptime_break_inst].@"break"; |
| 10188 | | try sema.addRuntimeBreak(&case_block, .{ |
| 10189 | | .block_inst = break_data.block_inst, |
| 10190 | | .operand = break_data.operand, |
| 10191 | | .inst = sema.comptime_break_inst, |
| 10192 | | }); |
| 10193 | | }, |
| 10194 | | else => |e| return e, |
| 10195 | | }; |
| 10162 | try sema.analyzeBodyRuntimeBreak(&case_block, body); |
| 10196 | 10163 | } else { |
| 10197 | 10164 | _ = try case_block.addNoOp(.unreach); |
| 10198 | 10165 | } |
| ... | ... | @@ -10273,18 +10240,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError |
| 10273 | 10240 | if (err_set and try sema.maybeErrorUnwrap(&case_block, body, operand)) { |
| 10274 | 10241 | // nothing to do here |
| 10275 | 10242 | } else { |
| 10276 | | _ = sema.analyzeBodyInner(&case_block, body) catch |err| switch (err) { |
| 10277 | | error.ComptimeBreak => { |
| 10278 | | const zir_datas = sema.code.instructions.items(.data); |
| 10279 | | const break_data = zir_datas[sema.comptime_break_inst].@"break"; |
| 10280 | | try sema.addRuntimeBreak(&case_block, .{ |
| 10281 | | .block_inst = break_data.block_inst, |
| 10282 | | .operand = break_data.operand, |
| 10283 | | .inst = sema.comptime_break_inst, |
| 10284 | | }); |
| 10285 | | }, |
| 10286 | | else => |e| return e, |
| 10287 | | }; |
| 10243 | try sema.analyzeBodyRuntimeBreak(&case_block, body); |
| 10288 | 10244 | } |
| 10289 | 10245 | |
| 10290 | 10246 | try wip_captures.finalize(); |
| ... | ... | @@ -10315,8 +10271,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError |
| 10315 | 10271 | |
| 10316 | 10272 | var final_else_body: []const Air.Inst.Index = &.{}; |
| 10317 | 10273 | if (special.body.len != 0 or !is_first or case_block.wantSafety()) { |
| 10318 | | var wip_captures = try WipCaptureScope.init(gpa, sema.perm_arena, child_block.wip_capture_scope); |
| 10319 | | defer wip_captures.deinit(); |
| 10274 | var emit_bb = false; |
| 10320 | 10275 | if (special.is_inline) switch (operand_ty.zigTypeTag()) { |
| 10321 | 10276 | .Enum => { |
| 10322 | 10277 | if (operand_ty.isNonexhaustiveEnum() and !union_originally) { |
| ... | ... | @@ -10324,7 +10279,6 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError |
| 10324 | 10279 | operand_ty.fmt(sema.mod), |
| 10325 | 10280 | }); |
| 10326 | 10281 | } |
| 10327 | | var emit_bb = false; |
| 10328 | 10282 | for (seen_enum_fields) |f, i| { |
| 10329 | 10283 | if (f != null) continue; |
| 10330 | 10284 | cases_len += 1; |
| ... | ... | @@ -10345,24 +10299,11 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError |
| 10345 | 10299 | emit_bb = true; |
| 10346 | 10300 | |
| 10347 | 10301 | if (analyze_body) { |
| 10348 | | _ = sema.analyzeBodyInner(&case_block, special.body) catch |err| switch (err) { |
| 10349 | | error.ComptimeBreak => { |
| 10350 | | const zir_datas = sema.code.instructions.items(.data); |
| 10351 | | const break_data = zir_datas[sema.comptime_break_inst].@"break"; |
| 10352 | | try sema.addRuntimeBreak(&case_block, .{ |
| 10353 | | .block_inst = break_data.block_inst, |
| 10354 | | .operand = break_data.operand, |
| 10355 | | .inst = sema.comptime_break_inst, |
| 10356 | | }); |
| 10357 | | }, |
| 10358 | | else => |e| return e, |
| 10359 | | }; |
| 10302 | try sema.analyzeBodyRuntimeBreak(&case_block, special.body); |
| 10360 | 10303 | } else { |
| 10361 | 10304 | _ = try case_block.addNoOp(.unreach); |
| 10362 | 10305 | } |
| 10363 | 10306 | |
| 10364 | | // try wip_captures.finalize(); |
| 10365 | | |
| 10366 | 10307 | try cases_extra.ensureUnusedCapacity(gpa, 3 + case_block.instructions.items.len); |
| 10367 | 10308 | cases_extra.appendAssumeCapacity(1); // items_len |
| 10368 | 10309 | cases_extra.appendAssumeCapacity(@intCast(u32, case_block.instructions.items.len)); |
| ... | ... | @@ -10376,7 +10317,6 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError |
| 10376 | 10317 | operand_ty.fmt(sema.mod), |
| 10377 | 10318 | }); |
| 10378 | 10319 | } |
| 10379 | | var emit_bb = false; |
| 10380 | 10320 | for (operand_ty.errorSetNames()) |error_name| { |
| 10381 | 10321 | if (seen_errors.contains(error_name)) continue; |
| 10382 | 10322 | cases_len += 1; |
| ... | ... | @@ -10391,20 +10331,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError |
| 10391 | 10331 | if (emit_bb) try sema.emitBackwardBranch(block, special_prong_src); |
| 10392 | 10332 | emit_bb = true; |
| 10393 | 10333 | |
| 10394 | | _ = sema.analyzeBodyInner(&case_block, special.body) catch |err| switch (err) { |
| 10395 | | error.ComptimeBreak => { |
| 10396 | | const zir_datas = sema.code.instructions.items(.data); |
| 10397 | | const break_data = zir_datas[sema.comptime_break_inst].@"break"; |
| 10398 | | try sema.addRuntimeBreak(&case_block, .{ |
| 10399 | | .block_inst = break_data.block_inst, |
| 10400 | | .operand = break_data.operand, |
| 10401 | | .inst = sema.comptime_break_inst, |
| 10402 | | }); |
| 10403 | | }, |
| 10404 | | else => |e| return e, |
| 10405 | | }; |
| 10406 | | |
| 10407 | | // try wip_captures.finalize(); |
| 10334 | try sema.analyzeBodyRuntimeBreak(&case_block, special.body); |
| 10408 | 10335 | |
| 10409 | 10336 | try cases_extra.ensureUnusedCapacity(gpa, 3 + case_block.instructions.items.len); |
| 10410 | 10337 | cases_extra.appendAssumeCapacity(1); // items_len |
| ... | ... | @@ -10415,7 +10342,6 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError |
| 10415 | 10342 | }, |
| 10416 | 10343 | .Int => { |
| 10417 | 10344 | var it = try RangeSetUnhandledIterator.init(sema, block, special_prong_src, operand_ty, range_set); |
| 10418 | | var emit_bb = false; |
| 10419 | 10345 | while (try it.next()) |cur| { |
| 10420 | 10346 | cases_len += 1; |
| 10421 | 10347 | |
| ... | ... | @@ -10428,30 +10354,16 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError |
| 10428 | 10354 | if (emit_bb) try sema.emitBackwardBranch(block, special_prong_src); |
| 10429 | 10355 | emit_bb = true; |
| 10430 | 10356 | |
| 10431 | | _ = sema.analyzeBodyInner(&case_block, special.body) catch |err| switch (err) { |
| 10432 | | error.ComptimeBreak => { |
| 10433 | | const zir_datas = sema.code.instructions.items(.data); |
| 10434 | | const break_data = zir_datas[sema.comptime_break_inst].@"break"; |
| 10435 | | try sema.addRuntimeBreak(&case_block, .{ |
| 10436 | | .block_inst = break_data.block_inst, |
| 10437 | | .operand = break_data.operand, |
| 10438 | | .inst = sema.comptime_break_inst, |
| 10439 | | }); |
| 10440 | | }, |
| 10441 | | else => |e| return e, |
| 10442 | | }; |
| 10443 | | |
| 10444 | | // try wip_captures.finalize(); |
| 10357 | try sema.analyzeBodyRuntimeBreak(&case_block, special.body); |
| 10445 | 10358 | |
| 10446 | 10359 | try cases_extra.ensureUnusedCapacity(gpa, 3 + case_block.instructions.items.len); |
| 10447 | 10360 | cases_extra.appendAssumeCapacity(1); // items_len |
| 10448 | 10361 | cases_extra.appendAssumeCapacity(@intCast(u32, case_block.instructions.items.len)); |
| 10449 | | cases_extra.appendAssumeCapacity(@enumToInt(item_ref)); |
| 10362 | cases_extra.appendAssumeCapacity(@enumToInt(case_block.inline_case_capture)); |
| 10450 | 10363 | cases_extra.appendSliceAssumeCapacity(case_block.instructions.items); |
| 10451 | 10364 | } |
| 10452 | 10365 | }, |
| 10453 | 10366 | .Bool => { |
| 10454 | | var emit_bb = false; |
| 10455 | 10367 | if (true_count == 0) { |
| 10456 | 10368 | cases_len += 1; |
| 10457 | 10369 | case_block.inline_case_capture = Air.Inst.Ref.bool_true; |
| ... | ... | @@ -10462,20 +10374,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError |
| 10462 | 10374 | if (emit_bb) try sema.emitBackwardBranch(block, special_prong_src); |
| 10463 | 10375 | emit_bb = true; |
| 10464 | 10376 | |
| 10465 | | _ = sema.analyzeBodyInner(&case_block, special.body) catch |err| switch (err) { |
| 10466 | | error.ComptimeBreak => { |
| 10467 | | const zir_datas = sema.code.instructions.items(.data); |
| 10468 | | const break_data = zir_datas[sema.comptime_break_inst].@"break"; |
| 10469 | | try sema.addRuntimeBreak(&case_block, .{ |
| 10470 | | .block_inst = break_data.block_inst, |
| 10471 | | .operand = break_data.operand, |
| 10472 | | .inst = sema.comptime_break_inst, |
| 10473 | | }); |
| 10474 | | }, |
| 10475 | | else => |e| return e, |
| 10476 | | }; |
| 10477 | | |
| 10478 | | // try wip_captures.finalize(); |
| 10377 | try sema.analyzeBodyRuntimeBreak(&case_block, special.body); |
| 10479 | 10378 | |
| 10480 | 10379 | try cases_extra.ensureUnusedCapacity(gpa, 3 + case_block.instructions.items.len); |
| 10481 | 10380 | cases_extra.appendAssumeCapacity(1); // items_len |
| ... | ... | @@ -10493,20 +10392,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError |
| 10493 | 10392 | if (emit_bb) try sema.emitBackwardBranch(block, special_prong_src); |
| 10494 | 10393 | emit_bb = true; |
| 10495 | 10394 | |
| 10496 | | _ = sema.analyzeBodyInner(&case_block, special.body) catch |err| switch (err) { |
| 10497 | | error.ComptimeBreak => { |
| 10498 | | const zir_datas = sema.code.instructions.items(.data); |
| 10499 | | const break_data = zir_datas[sema.comptime_break_inst].@"break"; |
| 10500 | | try sema.addRuntimeBreak(&case_block, .{ |
| 10501 | | .block_inst = break_data.block_inst, |
| 10502 | | .operand = break_data.operand, |
| 10503 | | .inst = sema.comptime_break_inst, |
| 10504 | | }); |
| 10505 | | }, |
| 10506 | | else => |e| return e, |
| 10507 | | }; |
| 10508 | | |
| 10509 | | // try wip_captures.finalize(); |
| 10395 | try sema.analyzeBodyRuntimeBreak(&case_block, special.body); |
| 10510 | 10396 | |
| 10511 | 10397 | try cases_extra.ensureUnusedCapacity(gpa, 3 + case_block.instructions.items.len); |
| 10512 | 10398 | cases_extra.appendAssumeCapacity(1); // items_len |
| ... | ... | @@ -10520,6 +10406,9 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError |
| 10520 | 10406 | }), |
| 10521 | 10407 | }; |
| 10522 | 10408 | |
| 10409 | var wip_captures = try WipCaptureScope.init(gpa, sema.perm_arena, child_block.wip_capture_scope); |
| 10410 | defer wip_captures.deinit(); |
| 10411 | |
| 10523 | 10412 | case_block.instructions.shrinkRetainingCapacity(0); |
| 10524 | 10413 | case_block.wip_capture_scope = wip_captures.scope; |
| 10525 | 10414 | case_block.inline_case_capture = .none; |
| ... | ... | @@ -10538,18 +10427,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError |
| 10538 | 10427 | { |
| 10539 | 10428 | // nothing to do here |
| 10540 | 10429 | } else if (special.body.len != 0 and analyze_body and !special.is_inline) { |
| 10541 | | _ = sema.analyzeBodyInner(&case_block, special.body) catch |err| switch (err) { |
| 10542 | | error.ComptimeBreak => { |
| 10543 | | const zir_datas = sema.code.instructions.items(.data); |
| 10544 | | const break_data = zir_datas[sema.comptime_break_inst].@"break"; |
| 10545 | | try sema.addRuntimeBreak(&case_block, .{ |
| 10546 | | .block_inst = break_data.block_inst, |
| 10547 | | .operand = break_data.operand, |
| 10548 | | .inst = sema.comptime_break_inst, |
| 10549 | | }); |
| 10550 | | }, |
| 10551 | | else => |e| return e, |
| 10552 | | }; |
| 10430 | try sema.analyzeBodyRuntimeBreak(&case_block, special.body); |
| 10553 | 10431 | } else { |
| 10554 | 10432 | // We still need a terminator in this block, but we have proven |
| 10555 | 10433 | // that it is unreachable. |
| ... | ... | @@ -15716,18 +15594,7 @@ fn zirCondbr( |
| 15716 | 15594 | sub_block.runtime_index.increment(); |
| 15717 | 15595 | defer sub_block.instructions.deinit(gpa); |
| 15718 | 15596 | |
| 15719 | | _ = sema.analyzeBodyInner(&sub_block, then_body) catch |err| switch (err) { |
| 15720 | | error.ComptimeBreak => { |
| 15721 | | const zir_datas = sema.code.instructions.items(.data); |
| 15722 | | const break_data = zir_datas[sema.comptime_break_inst].@"break"; |
| 15723 | | try sema.addRuntimeBreak(&sub_block, .{ |
| 15724 | | .block_inst = break_data.block_inst, |
| 15725 | | .operand = break_data.operand, |
| 15726 | | .inst = sema.comptime_break_inst, |
| 15727 | | }); |
| 15728 | | }, |
| 15729 | | else => |e| return e, |
| 15730 | | }; |
| 15597 | try sema.analyzeBodyRuntimeBreak(&sub_block, then_body); |
| 15731 | 15598 | const true_instructions = sub_block.instructions.toOwnedSlice(gpa); |
| 15732 | 15599 | defer gpa.free(true_instructions); |
| 15733 | 15600 | |
| ... | ... | @@ -15746,18 +15613,7 @@ fn zirCondbr( |
| 15746 | 15613 | if (err_cond != null and try sema.maybeErrorUnwrap(&sub_block, else_body, err_cond.?)) { |
| 15747 | 15614 | // nothing to do |
| 15748 | 15615 | } else { |
| 15749 | | _ = sema.analyzeBodyInner(&sub_block, else_body) catch |err| switch (err) { |
| 15750 | | error.ComptimeBreak => { |
| 15751 | | const zir_datas = sema.code.instructions.items(.data); |
| 15752 | | const break_data = zir_datas[sema.comptime_break_inst].@"break"; |
| 15753 | | try sema.addRuntimeBreak(&sub_block, .{ |
| 15754 | | .block_inst = break_data.block_inst, |
| 15755 | | .operand = break_data.operand, |
| 15756 | | .inst = sema.comptime_break_inst, |
| 15757 | | }); |
| 15758 | | }, |
| 15759 | | else => |e| return e, |
| 15760 | | }; |
| 15616 | try sema.analyzeBodyRuntimeBreak(&sub_block, else_body); |
| 15761 | 15617 | } |
| 15762 | 15618 | try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.CondBr).Struct.fields.len + |
| 15763 | 15619 | true_instructions.len + sub_block.instructions.items.len); |