| ... | @@ -15705,11 +15705,32 @@ static TypeTableEntry *ir_analyze_instruction_type_info(IrAnalyze *ira, | ... | @@ -15705,11 +15705,32 @@ static TypeTableEntry *ir_analyze_instruction_type_info(IrAnalyze *ira, |
| 15705 | assert(var_value->type->id == TypeTableEntryIdMetaType); | 15705 | assert(var_value->type->id == TypeTableEntryIdMetaType); |
| 15706 | TypeTableEntry *result_type = var_value->data.x_type; | 15706 | TypeTableEntry *result_type = var_value->data.x_type; |
| 15707 | | 15707 | |
| 15708 | // TODO: Check if we need to explicitely make a &const TypeInfo here, I think we don't. | | |
| 15709 | ConstExprValue *out_val = ir_build_const_from(ira, &instruction->base); | 15708 | ConstExprValue *out_val = ir_build_const_from(ira, &instruction->base); |
| 15710 | out_val->data.x_struct.fields = create_const_vals(1); | 15709 | bigint_init_unsigned(&out_val->data.x_union.tag, type_id_index(type_entry->id)); |
| 15711 | // TODO: Fill the struct | 15710 | out_val->data.x_union.parent.id = ConstParentIdNone; |
| 15712 | zig_panic("Building TypeInfo..."); | 15711 | |
| | 15712 | switch (type_entry->id) { |
| | 15713 | case TypeTableEntryIdInvalid: |
| | 15714 | zig_unreachable(); |
| | 15715 | case TypeTableEntryIdMetaType: |
| | 15716 | case TypeTableEntryIdVoid: |
| | 15717 | case TypeTableEntryIdBool: |
| | 15718 | case TypeTableEntryIdUnreachable: |
| | 15719 | case TypeTableEntryIdNumLitFloat: |
| | 15720 | case TypeTableEntryIdNumLitInt: |
| | 15721 | case TypeTableEntryIdUndefLit: |
| | 15722 | case TypeTableEntryIdNullLit: |
| | 15723 | case TypeTableEntryIdNamespace: |
| | 15724 | case TypeTableEntryIdBlock: |
| | 15725 | case TypeTableEntryIdArgTuple: |
| | 15726 | case TypeTableEntryIdOpaque: |
| | 15727 | // TODO: Check out this is the way to handle voids; |
| | 15728 | out_val->data.x_union.payload = nullptr; |
| | 15729 | break; |
| | 15730 | default: |
| | 15731 | zig_panic("@typeInfo unsupported for %s", buf_ptr(&type_entry->name)); |
| | 15732 | } |
| | 15733 | |
| 15713 | return result_type; | 15734 | return result_type; |
| 15714 | } | 15735 | } |
| 15715 | | 15736 | |