| ... | ... | @@ -9960,6 +9960,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError |
| 9960 | 9960 | const item_ref = @intToEnum(Zir.Inst.Ref, sema.code.extra[extra_index]); |
| 9961 | 9961 | extra_index += 1; |
| 9962 | 9962 | const body_len = @truncate(u31, sema.code.extra[extra_index]); |
| 9963 | const is_inline = sema.code.extra[extra_index] >> 31 != 0; |
| 9963 | 9964 | extra_index += 1; |
| 9964 | 9965 | const body = sema.code.extra[extra_index..][0..body_len]; |
| 9965 | 9966 | extra_index += body_len; |
| ... | ... | @@ -9968,6 +9969,8 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError |
| 9968 | 9969 | // Validation above ensured these will succeed. |
| 9969 | 9970 | const item_val = sema.resolveConstValue(&child_block, .unneeded, item, "") catch unreachable; |
| 9970 | 9971 | if (operand_val.eql(item_val, operand_ty, sema.mod)) { |
| 9972 | if (is_inline) child_block.inline_case_capture = operand; |
| 9973 | |
| 9971 | 9974 | if (err_set) try sema.maybeErrorUnwrapComptime(&child_block, body, operand); |
| 9972 | 9975 | return sema.resolveBlockBody(block, src, &child_block, body, inst, merges); |
| 9973 | 9976 | } |
| ... | ... | @@ -9981,6 +9984,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError |
| 9981 | 9984 | const ranges_len = sema.code.extra[extra_index]; |
| 9982 | 9985 | extra_index += 1; |
| 9983 | 9986 | const body_len = @truncate(u31, sema.code.extra[extra_index]); |
| 9987 | const is_inline = sema.code.extra[extra_index] >> 31 != 0; |
| 9984 | 9988 | extra_index += 1; |
| 9985 | 9989 | const items = sema.code.refSlice(extra_index, items_len); |
| 9986 | 9990 | extra_index += items_len; |
| ... | ... | @@ -9991,6 +9995,8 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError |
| 9991 | 9995 | // Validation above ensured these will succeed. |
| 9992 | 9996 | const item_val = sema.resolveConstValue(&child_block, .unneeded, item, "") catch unreachable; |
| 9993 | 9997 | if (operand_val.eql(item_val, operand_ty, sema.mod)) { |
| 9998 | if (is_inline) child_block.inline_case_capture = operand; |
| 9999 | |
| 9994 | 10000 | if (err_set) try sema.maybeErrorUnwrapComptime(&child_block, body, operand); |
| 9995 | 10001 | return sema.resolveBlockBody(block, src, &child_block, body, inst, merges); |
| 9996 | 10002 | } |
| ... | ... | @@ -10009,6 +10015,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError |
| 10009 | 10015 | if ((try sema.compare(block, src, operand_val, .gte, first_tv.val, operand_ty)) and |
| 10010 | 10016 | (try sema.compare(block, src, operand_val, .lte, last_tv.val, operand_ty))) |
| 10011 | 10017 | { |
| 10018 | if (is_inline) child_block.inline_case_capture = operand; |
| 10012 | 10019 | if (err_set) try sema.maybeErrorUnwrapComptime(&child_block, body, operand); |
| 10013 | 10020 | return sema.resolveBlockBody(block, src, &child_block, body, inst, merges); |
| 10014 | 10021 | } |
| ... | ... | @@ -10018,6 +10025,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError |
| 10018 | 10025 | } |
| 10019 | 10026 | } |
| 10020 | 10027 | if (err_set) try sema.maybeErrorUnwrapComptime(&child_block, special.body, operand); |
| 10028 | if (special.is_inline) child_block.inline_case_capture = operand; |
| 10021 | 10029 | return sema.resolveBlockBody(block, src, &child_block, special.body, inst, merges); |
| 10022 | 10030 | } |
| 10023 | 10031 | |