| ... | ... | @@ -4274,14 +4274,14 @@ static IrInstGen *ir_build_err_to_int_gen(IrAnalyze *ira, Scope *scope, AstNode |
| 4274 | 4274 | |
| 4275 | 4275 | static IrInstSrc *ir_build_check_switch_prongs(IrBuilderSrc *irb, Scope *scope, AstNode *source_node, |
| 4276 | 4276 | IrInstSrc *target_value, IrInstSrcCheckSwitchProngsRange *ranges, size_t range_count, |
| 4277 | | bool have_else_prong, bool have_underscore_prong) |
| 4277 | AstNode* else_prong, bool have_underscore_prong) |
| 4278 | 4278 | { |
| 4279 | 4279 | IrInstSrcCheckSwitchProngs *instruction = ir_build_instruction<IrInstSrcCheckSwitchProngs>( |
| 4280 | 4280 | irb, scope, source_node); |
| 4281 | 4281 | instruction->target_value = target_value; |
| 4282 | 4282 | instruction->ranges = ranges; |
| 4283 | 4283 | instruction->range_count = range_count; |
| 4284 | | instruction->have_else_prong = have_else_prong; |
| 4284 | instruction->else_prong = else_prong; |
| 4285 | 4285 | instruction->have_underscore_prong = have_underscore_prong; |
| 4286 | 4286 | |
| 4287 | 4287 | ir_ref_instruction(target_value, irb->current_basic_block); |
| ... | ... | @@ -9305,7 +9305,7 @@ static IrInstSrc *ir_gen_switch_expr(IrBuilderSrc *irb, Scope *scope, AstNode *n |
| 9305 | 9305 | } |
| 9306 | 9306 | |
| 9307 | 9307 | IrInstSrc *switch_prongs_void = ir_build_check_switch_prongs(irb, scope, node, target_value, |
| 9308 | | check_ranges.items, check_ranges.length, else_prong != nullptr, underscore_prong != nullptr); |
| 9308 | check_ranges.items, check_ranges.length, else_prong, underscore_prong != nullptr); |
| 9309 | 9309 | |
| 9310 | 9310 | IrInstSrc *br_instruction; |
| 9311 | 9311 | if (cases.length == 0) { |
| ... | ... | @@ -28685,7 +28685,7 @@ static IrInstGen *ir_analyze_instruction_check_switch_prongs(IrAnalyze *ira, |
| 28685 | 28685 | buf_ptr(enum_field->name))); |
| 28686 | 28686 | } |
| 28687 | 28687 | } |
| 28688 | | } else if (!instruction->have_else_prong) { |
| 28688 | } else if (instruction->else_prong == nullptr) { |
| 28689 | 28689 | if (switch_type->data.enumeration.non_exhaustive) { |
| 28690 | 28690 | ir_add_error(ira, &instruction->base.base, |
| 28691 | 28691 | buf_sprintf("switch on non-exhaustive enum must include `else` or `_` prong")); |
| ... | ... | @@ -28746,7 +28746,7 @@ static IrInstGen *ir_analyze_instruction_check_switch_prongs(IrAnalyze *ira, |
| 28746 | 28746 | } |
| 28747 | 28747 | field_prev_uses[start_index] = start_value->base.source_node; |
| 28748 | 28748 | } |
| 28749 | | if (!instruction->have_else_prong) { |
| 28749 | if (instruction->else_prong == nullptr) { |
| 28750 | 28750 | if (type_is_global_error_set(switch_type)) { |
| 28751 | 28751 | ir_add_error(ira, &instruction->base.base, |
| 28752 | 28752 | buf_sprintf("else prong required when switching on type 'anyerror'")); |
| ... | ... | @@ -28808,7 +28808,7 @@ static IrInstGen *ir_analyze_instruction_check_switch_prongs(IrAnalyze *ira, |
| 28808 | 28808 | return ira->codegen->invalid_inst_gen; |
| 28809 | 28809 | } |
| 28810 | 28810 | } |
| 28811 | | if (!instruction->have_else_prong) { |
| 28811 | if (instruction->else_prong == nullptr) { |
| 28812 | 28812 | BigInt min_val; |
| 28813 | 28813 | eval_min_max_value_int(ira->codegen, switch_type, &min_val, false); |
| 28814 | 28814 | BigInt max_val; |
| ... | ... | @@ -28847,11 +28847,11 @@ static IrInstGen *ir_analyze_instruction_check_switch_prongs(IrAnalyze *ira, |
| 28847 | 28847 | return ira->codegen->invalid_inst_gen; |
| 28848 | 28848 | } |
| 28849 | 28849 | } |
| 28850 | | if (((seenTrue < 1) || (seenFalse < 1)) && !instruction->have_else_prong) { |
| 28850 | if (((seenTrue < 1) || (seenFalse < 1)) && instruction->else_prong == nullptr) { |
| 28851 | 28851 | ir_add_error(ira, &instruction->base.base, buf_sprintf("switch must handle all possibilities")); |
| 28852 | 28852 | return ira->codegen->invalid_inst_gen; |
| 28853 | 28853 | } |
| 28854 | | } else if (!instruction->have_else_prong) { |
| 28854 | } else if (instruction->else_prong == nullptr) { |
| 28855 | 28855 | ir_add_error(ira, &instruction->base.base, |
| 28856 | 28856 | buf_sprintf("else prong required when switching on type '%s'", buf_ptr(&switch_type->name))); |
| 28857 | 28857 | return ira->codegen->invalid_inst_gen; |