| ... | @@ -14504,28 +14504,6 @@ static ZigType *ir_result_loc_expected_type(IrAnalyze *ira, IrInstruction *suspe | ... | @@ -14504,28 +14504,6 @@ static ZigType *ir_result_loc_expected_type(IrAnalyze *ira, IrInstruction *suspe |
| 14504 | return nullptr; | 14504 | return nullptr; |
| 14505 | case ResultLocIdInstruction: | 14505 | case ResultLocIdInstruction: |
| 14506 | return result_loc->source_instruction->child->value.type; | 14506 | return result_loc->source_instruction->child->value.type; |
| 14507 | case ResultLocIdField: { | | |
| 14508 | if (result_loc->resolved_loc != nullptr) { | | |
| 14509 | ZigType *ptr_type = result_loc->resolved_loc->value.type; | | |
| 14510 | assert(ptr_type->id == ZigTypeIdPointer); | | |
| 14511 | return ptr_type->data.pointer.child_type; | | |
| 14512 | } | | |
| 14513 | ResultLocField *result_loc_field = reinterpret_cast<ResultLocField *>(result_loc); | | |
| 14514 | ZigType *container_type = ir_resolve_type(ira, result_loc_field->container_type->child); | | |
| 14515 | if (type_is_invalid(container_type)) | | |
| 14516 | return ira->codegen->builtin_types.entry_invalid; | | |
| 14517 | if (container_type->id == ZigTypeIdStruct) { | | |
| 14518 | TypeStructField *field = find_struct_type_field(container_type, result_loc_field->name); | | |
| 14519 | if (field == nullptr) { | | |
| 14520 | return ira->codegen->builtin_types.entry_invalid; | | |
| 14521 | } | | |
| 14522 | return field->type_entry; | | |
| 14523 | } else if (container_type->id == ZigTypeIdUnion) { | | |
| 14524 | zig_panic("TODO"); | | |
| 14525 | } else { | | |
| 14526 | zig_unreachable(); | | |
| 14527 | } | | |
| 14528 | } | | |
| 14529 | case ResultLocIdReturn: | 14507 | case ResultLocIdReturn: |
| 14530 | return ira->explicit_return_type; | 14508 | return ira->explicit_return_type; |
| 14531 | case ResultLocIdPeer: | 14509 | case ResultLocIdPeer: |
| ... | @@ -14606,26 +14584,6 @@ static IrInstruction *ir_resolve_result(IrAnalyze *ira, IrInstruction *suspend_s | ... | @@ -14606,26 +14584,6 @@ static IrInstruction *ir_resolve_result(IrAnalyze *ira, IrInstruction *suspend_s |
| 14606 | result_loc->resolved_loc = result_loc->source_instruction->child; | 14584 | result_loc->resolved_loc = result_loc->source_instruction->child; |
| 14607 | return result_loc->resolved_loc; | 14585 | return result_loc->resolved_loc; |
| 14608 | } | 14586 | } |
| 14609 | case ResultLocIdField: { | | |
| 14610 | ResultLocField *result_loc_field = reinterpret_cast<ResultLocField *>(result_loc); | | |
| 14611 | | | |
| 14612 | ZigType *container_type = ir_resolve_type(ira, result_loc_field->container_type->child); | | |
| 14613 | if (type_is_invalid(container_type)) | | |
| 14614 | return ira->codegen->invalid_instruction; | | |
| 14615 | | | |
| 14616 | IrInstruction *parent_result_loc = ir_resolve_result(ira, suspend_source_instr, | | |
| 14617 | result_loc_field->parent, container_type, nullptr); | | |
| 14618 | if (parent_result_loc == nullptr || type_is_invalid(parent_result_loc->value.type) || | | |
| 14619 | parent_result_loc->value.type->id == ZigTypeIdUnreachable) | | |
| 14620 | { | | |
| 14621 | return parent_result_loc; | | |
| 14622 | } | | |
| 14623 | | | |
| 14624 | result_loc->written = true; | | |
| 14625 | result_loc->resolved_loc = ir_analyze_container_field_ptr(ira, result_loc_field->name, | | |
| 14626 | suspend_source_instr, parent_result_loc, container_type); | | |
| 14627 | return result_loc->resolved_loc; | | |
| 14628 | } | | |
| 14629 | case ResultLocIdReturn: { | 14587 | case ResultLocIdReturn: { |
| 14630 | bool is_comptime = value != nullptr && value->value.special != ConstValSpecialRuntime; | 14588 | bool is_comptime = value != nullptr && value->value.special != ConstValSpecialRuntime; |
| 14631 | if (is_comptime) return nullptr; | 14589 | if (is_comptime) return nullptr; |