| ... | @@ -2146,6 +2146,7 @@ static IrInstSrc *ir_build_const_undefined(IrBuilderSrc *irb, Scope *scope, AstN | ... | @@ -2146,6 +2146,7 @@ static IrInstSrc *ir_build_const_undefined(IrBuilderSrc *irb, Scope *scope, AstN |
| 2146 | IrInstSrcConst *const_instruction = ir_create_instruction<IrInstSrcConst>(irb, scope, source_node); | 2146 | IrInstSrcConst *const_instruction = ir_create_instruction<IrInstSrcConst>(irb, scope, source_node); |
| 2147 | ir_instruction_append(irb->current_basic_block, &const_instruction->base); | 2147 | ir_instruction_append(irb->current_basic_block, &const_instruction->base); |
| 2148 | const_instruction->value = irb->codegen->intern.for_undefined(); | 2148 | const_instruction->value = irb->codegen->intern.for_undefined(); |
| | 2149 | const_instruction->value->special = ConstValSpecialUndef; |
| 2149 | return &const_instruction->base; | 2150 | return &const_instruction->base; |
| 2150 | } | 2151 | } |
| 2151 | | 2152 | |
| ... | @@ -14916,6 +14917,9 @@ static IrInstGen *ir_analyze_struct_literal_to_struct(IrAnalyze *ira, IrInst* so | ... | @@ -14916,6 +14917,9 @@ static IrInstGen *ir_analyze_struct_literal_to_struct(IrAnalyze *ira, IrInst* so |
| 14916 | field_val->parent.data.p_struct.struct_val = const_result->value; | 14917 | field_val->parent.data.p_struct.struct_val = const_result->value; |
| 14917 | field_val->parent.data.p_struct.field_index = dst_field->src_index; | 14918 | field_val->parent.data.p_struct.field_index = dst_field->src_index; |
| 14918 | field_values[dst_field->src_index] = field_val; | 14919 | field_values[dst_field->src_index] = field_val; |
| | 14920 | if (field_val->type->id == ZigTypeIdUndefined && dst_field->type_entry->id != ZigTypeIdUndefined) { |
| | 14921 | field_values[dst_field->src_index]->special = ConstValSpecialUndef; |
| | 14922 | } |
| 14919 | } else { | 14923 | } else { |
| 14920 | is_comptime = false; | 14924 | is_comptime = false; |
| 14921 | } | 14925 | } |
| ... | @@ -15648,7 +15652,7 @@ static IrInstGen *ir_analyze_cast(IrAnalyze *ira, IrInst *source_instr, | ... | @@ -15648,7 +15652,7 @@ static IrInstGen *ir_analyze_cast(IrAnalyze *ira, IrInst *source_instr, |
| 15648 | wanted_type->data.array.len == field_count) | 15652 | wanted_type->data.array.len == field_count) |
| 15649 | { | 15653 | { |
| 15650 | return ir_analyze_struct_literal_to_array(ira, source_instr, value, wanted_type); | 15654 | return ir_analyze_struct_literal_to_array(ira, source_instr, value, wanted_type); |
| 15651 | } else if (wanted_type->id == ZigTypeIdStruct && | 15655 | } else if (wanted_type->id == ZigTypeIdStruct && !is_slice(wanted_type) && |
| 15652 | (!is_array_init || field_count == 0)) | 15656 | (!is_array_init || field_count == 0)) |
| 15653 | { | 15657 | { |
| 15654 | return ir_analyze_struct_literal_to_struct(ira, source_instr, value, wanted_type); | 15658 | return ir_analyze_struct_literal_to_struct(ira, source_instr, value, wanted_type); |
| ... | @@ -22301,6 +22305,7 @@ static IrInstGen *ir_analyze_container_member_access_inner(IrAnalyze *ira, | ... | @@ -22301,6 +22305,7 @@ static IrInstGen *ir_analyze_container_member_access_inner(IrAnalyze *ira, |
| 22301 | | 22305 | |
| 22302 | static void memoize_field_init_val(CodeGen *codegen, ZigType *container_type, TypeStructField *field) { | 22306 | static void memoize_field_init_val(CodeGen *codegen, ZigType *container_type, TypeStructField *field) { |
| 22303 | if (field->init_val != nullptr) return; | 22307 | if (field->init_val != nullptr) return; |
| | 22308 | if (field->decl_node == nullptr) return; |
| 22304 | if (field->decl_node->type != NodeTypeStructField) return; | 22309 | if (field->decl_node->type != NodeTypeStructField) return; |
| 22305 | AstNode *init_node = field->decl_node->data.struct_field.value; | 22310 | AstNode *init_node = field->decl_node->data.struct_field.value; |
| 22306 | if (init_node == nullptr) return; | 22311 | if (init_node == nullptr) return; |
| ... | @@ -26016,6 +26021,9 @@ static ZigType *type_info_to_type(IrAnalyze *ira, IrInst *source_instr, ZigTypeI | ... | @@ -26016,6 +26021,9 @@ static ZigType *type_info_to_type(IrAnalyze *ira, IrInst *source_instr, ZigTypeI |
| 26016 | assert(payload->special == ConstValSpecialStatic); | 26021 | assert(payload->special == ConstValSpecialStatic); |
| 26017 | assert(payload->type == type_info_pointer_type); | 26022 | assert(payload->type == type_info_pointer_type); |
| 26018 | ZigValue *size_value = get_const_field(ira, source_instr->source_node, payload, "size", 0); | 26023 | ZigValue *size_value = get_const_field(ira, source_instr->source_node, payload, "size", 0); |
| | 26024 | if (size_value == nullptr) |
| | 26025 | return ira->codegen->invalid_inst_gen->value->type; |
| | 26026 | |
| 26019 | assert(size_value->type == ir_type_info_get_type(ira, "Size", type_info_pointer_type)); | 26027 | assert(size_value->type == ir_type_info_get_type(ira, "Size", type_info_pointer_type)); |
| 26020 | BuiltinPtrSize size_enum_index = (BuiltinPtrSize)bigint_as_u32(&size_value->data.x_enum_tag); | 26028 | BuiltinPtrSize size_enum_index = (BuiltinPtrSize)bigint_as_u32(&size_value->data.x_enum_tag); |
| 26021 | PtrLen ptr_len = size_enum_index_to_ptr_len(size_enum_index); | 26029 | PtrLen ptr_len = size_enum_index_to_ptr_len(size_enum_index); |
| ... | @@ -26099,13 +26107,21 @@ static ZigType *type_info_to_type(IrAnalyze *ira, IrInst *source_instr, ZigTypeI | ... | @@ -26099,13 +26107,21 @@ static ZigType *type_info_to_type(IrAnalyze *ira, IrInst *source_instr, ZigTypeI |
| 26099 | assert(payload->special == ConstValSpecialStatic); | 26107 | assert(payload->special == ConstValSpecialStatic); |
| 26100 | assert(payload->type == ir_type_info_get_type(ira, "Optional", nullptr)); | 26108 | assert(payload->type == ir_type_info_get_type(ira, "Optional", nullptr)); |
| 26101 | ZigType *child_type = get_const_field_meta_type(ira, source_instr->source_node, payload, "child", 0); | 26109 | ZigType *child_type = get_const_field_meta_type(ira, source_instr->source_node, payload, "child", 0); |
| | 26110 | if (type_is_invalid(child_type)) |
| | 26111 | return ira->codegen->invalid_inst_gen->value->type; |
| 26102 | return get_optional_type(ira->codegen, child_type); | 26112 | return get_optional_type(ira->codegen, child_type); |
| 26103 | } | 26113 | } |
| 26104 | case ZigTypeIdErrorUnion: { | 26114 | case ZigTypeIdErrorUnion: { |
| 26105 | assert(payload->special == ConstValSpecialStatic); | 26115 | assert(payload->special == ConstValSpecialStatic); |
| 26106 | assert(payload->type == ir_type_info_get_type(ira, "ErrorUnion", nullptr)); | 26116 | assert(payload->type == ir_type_info_get_type(ira, "ErrorUnion", nullptr)); |
| 26107 | ZigType *err_set_type = get_const_field_meta_type(ira, source_instr->source_node, payload, "error_set", 0); | 26117 | ZigType *err_set_type = get_const_field_meta_type(ira, source_instr->source_node, payload, "error_set", 0); |
| | 26118 | if (type_is_invalid(err_set_type)) |
| | 26119 | return ira->codegen->invalid_inst_gen->value->type; |
| | 26120 | |
| 26108 | ZigType *payload_type = get_const_field_meta_type(ira, source_instr->source_node, payload, "payload", 1); | 26121 | ZigType *payload_type = get_const_field_meta_type(ira, source_instr->source_node, payload, "payload", 1); |
| | 26122 | if (type_is_invalid(payload_type)) |
| | 26123 | return ira->codegen->invalid_inst_gen->value->type; |
| | 26124 | |
| 26109 | return get_error_union_type(ira->codegen, err_set_type, payload_type); | 26125 | return get_error_union_type(ira->codegen, err_set_type, payload_type); |
| 26110 | } | 26126 | } |
| 26111 | case ZigTypeIdOpaque: { | 26127 | case ZigTypeIdOpaque: { |
| ... | @@ -26119,8 +26135,10 @@ static ZigType *type_info_to_type(IrAnalyze *ira, IrInst *source_instr, ZigTypeI | ... | @@ -26119,8 +26135,10 @@ static ZigType *type_info_to_type(IrAnalyze *ira, IrInst *source_instr, ZigTypeI |
| 26119 | assert(payload->special == ConstValSpecialStatic); | 26135 | assert(payload->special == ConstValSpecialStatic); |
| 26120 | assert(payload->type == ir_type_info_get_type(ira, "Vector", nullptr)); | 26136 | assert(payload->type == ir_type_info_get_type(ira, "Vector", nullptr)); |
| 26121 | BigInt *len = get_const_field_lit_int(ira, source_instr->source_node, payload, "len", 0); | 26137 | BigInt *len = get_const_field_lit_int(ira, source_instr->source_node, payload, "len", 0); |
| | 26138 | if (len == nullptr) |
| | 26139 | return ira->codegen->invalid_inst_gen->value->type; |
| | 26140 | |
| 26122 | ZigType *child_type = get_const_field_meta_type(ira, source_instr->source_node, payload, "child", 1); | 26141 | ZigType *child_type = get_const_field_meta_type(ira, source_instr->source_node, payload, "child", 1); |
| 26123 | Error err; | | |
| 26124 | if ((err = ir_validate_vector_elem_type(ira, source_instr->source_node, child_type))) { | 26142 | if ((err = ir_validate_vector_elem_type(ira, source_instr->source_node, child_type))) { |
| 26125 | return ira->codegen->invalid_inst_gen->value->type; | 26143 | return ira->codegen->invalid_inst_gen->value->type; |
| 26126 | } | 26144 | } |
| ... | @@ -26130,6 +26148,9 @@ static ZigType *type_info_to_type(IrAnalyze *ira, IrInst *source_instr, ZigTypeI | ... | @@ -26130,6 +26148,9 @@ static ZigType *type_info_to_type(IrAnalyze *ira, IrInst *source_instr, ZigTypeI |
| 26130 | assert(payload->special == ConstValSpecialStatic); | 26148 | assert(payload->special == ConstValSpecialStatic); |
| 26131 | assert(payload->type == ir_type_info_get_type(ira, "AnyFrame", nullptr)); | 26149 | assert(payload->type == ir_type_info_get_type(ira, "AnyFrame", nullptr)); |
| 26132 | ZigType *child_type = get_const_field_meta_type_optional(ira, source_instr->source_node, payload, "child", 0); | 26150 | ZigType *child_type = get_const_field_meta_type_optional(ira, source_instr->source_node, payload, "child", 0); |
| | 26151 | if (child_type != nullptr && type_is_invalid(child_type)) |
| | 26152 | return ira->codegen->invalid_inst_gen->value->type; |
| | 26153 | |
| 26133 | return get_any_frame_type(ira->codegen, child_type); | 26154 | return get_any_frame_type(ira->codegen, child_type); |
| 26134 | } | 26155 | } |
| 26135 | case ZigTypeIdEnumLiteral: | 26156 | case ZigTypeIdEnumLiteral: |
| ... | @@ -26138,6 +26159,9 @@ static ZigType *type_info_to_type(IrAnalyze *ira, IrInst *source_instr, ZigTypeI | ... | @@ -26138,6 +26159,9 @@ static ZigType *type_info_to_type(IrAnalyze *ira, IrInst *source_instr, ZigTypeI |
| 26138 | assert(payload->special == ConstValSpecialStatic); | 26159 | assert(payload->special == ConstValSpecialStatic); |
| 26139 | assert(payload->type == ir_type_info_get_type(ira, "Frame", nullptr)); | 26160 | assert(payload->type == ir_type_info_get_type(ira, "Frame", nullptr)); |
| 26140 | ZigValue *function = get_const_field(ira, source_instr->source_node, payload, "function", 0); | 26161 | ZigValue *function = get_const_field(ira, source_instr->source_node, payload, "function", 0); |
| | 26162 | if (function == nullptr) |
| | 26163 | return ira->codegen->invalid_inst_gen->value->type; |
| | 26164 | |
| 26141 | assert(function->type->id == ZigTypeIdFn); | 26165 | assert(function->type->id == ZigTypeIdFn); |
| 26142 | ZigFn *fn = function->data.x_ptr.data.fn.fn_entry; | 26166 | ZigFn *fn = function->data.x_ptr.data.fn.fn_entry; |
| 26143 | return get_fn_frame_type(ira->codegen, fn); | 26167 | return get_fn_frame_type(ira->codegen, fn); |
| ... | @@ -26172,7 +26196,6 @@ static ZigType *type_info_to_type(IrAnalyze *ira, IrInst *source_instr, ZigTypeI | ... | @@ -26172,7 +26196,6 @@ static ZigType *type_info_to_type(IrAnalyze *ira, IrInst *source_instr, ZigTypeI |
| 26172 | assert(error->type == ir_type_info_get_type(ira, "Error", nullptr)); | 26196 | assert(error->type == ir_type_info_get_type(ira, "Error", nullptr)); |
| 26173 | ErrorTableEntry *err_entry = heap::c_allocator.create<ErrorTableEntry>(); | 26197 | ErrorTableEntry *err_entry = heap::c_allocator.create<ErrorTableEntry>(); |
| 26174 | err_entry->decl_node = source_instr->source_node; | 26198 | err_entry->decl_node = source_instr->source_node; |
| 26175 | Error err; | | |
| 26176 | if ((err = get_const_field_buf(ira, source_instr->source_node, error, "name", 0, &err_entry->name))) | 26199 | if ((err = get_const_field_buf(ira, source_instr->source_node, error, "name", 0, &err_entry->name))) |
| 26177 | return ira->codegen->invalid_inst_gen->value->type; | 26200 | return ira->codegen->invalid_inst_gen->value->type; |
| 26178 | auto existing_entry = ira->codegen->error_table.put_unique(&err_entry->name, err_entry); | 26201 | auto existing_entry = ira->codegen->error_table.put_unique(&err_entry->name, err_entry); |
| ... | @@ -26199,11 +26222,15 @@ static ZigType *type_info_to_type(IrAnalyze *ira, IrInst *source_instr, ZigTypeI | ... | @@ -26199,11 +26222,15 @@ static ZigType *type_info_to_type(IrAnalyze *ira, IrInst *source_instr, ZigTypeI |
| 26199 | assert(payload->type == ir_type_info_get_type(ira, "Struct", nullptr)); | 26222 | assert(payload->type == ir_type_info_get_type(ira, "Struct", nullptr)); |
| 26200 | | 26223 | |
| 26201 | ZigValue *layout_value = get_const_field(ira, source_instr->source_node, payload, "layout", 0); | 26224 | ZigValue *layout_value = get_const_field(ira, source_instr->source_node, payload, "layout", 0); |
| | 26225 | if (layout_value == nullptr) |
| | 26226 | return ira->codegen->invalid_inst_gen->value->type; |
| 26202 | assert(layout_value->special == ConstValSpecialStatic); | 26227 | assert(layout_value->special == ConstValSpecialStatic); |
| 26203 | assert(layout_value->type == ir_type_info_get_type(ira, "ContainerLayout", nullptr)); | 26228 | assert(layout_value->type == ir_type_info_get_type(ira, "ContainerLayout", nullptr)); |
| 26204 | ContainerLayout layout = (ContainerLayout)bigint_as_u32(&layout_value->data.x_enum_tag); | 26229 | ContainerLayout layout = (ContainerLayout)bigint_as_u32(&layout_value->data.x_enum_tag); |
| 26205 | | 26230 | |
| 26206 | ZigValue *fields_value = get_const_field(ira, source_instr->source_node, payload, "fields", 1); | 26231 | ZigValue *fields_value = get_const_field(ira, source_instr->source_node, payload, "fields", 1); |
| | 26232 | if (fields_value == nullptr) |
| | 26233 | return ira->codegen->invalid_inst_gen->value->type; |
| 26207 | assert(fields_value->special == ConstValSpecialStatic); | 26234 | assert(fields_value->special == ConstValSpecialStatic); |
| 26208 | assert(is_slice(fields_value->type)); | 26235 | assert(is_slice(fields_value->type)); |
| 26209 | ZigValue *fields_ptr = fields_value->data.x_struct.fields[slice_ptr_index]; | 26236 | ZigValue *fields_ptr = fields_value->data.x_struct.fields[slice_ptr_index]; |
| ... | @@ -26211,6 +26238,8 @@ static ZigType *type_info_to_type(IrAnalyze *ira, IrInst *source_instr, ZigTypeI | ... | @@ -26211,6 +26238,8 @@ static ZigType *type_info_to_type(IrAnalyze *ira, IrInst *source_instr, ZigTypeI |
| 26211 | size_t fields_len = bigint_as_usize(&fields_len_value->data.x_bigint); | 26238 | size_t fields_len = bigint_as_usize(&fields_len_value->data.x_bigint); |
| 26212 | | 26239 | |
| 26213 | ZigValue *decls_value = get_const_field(ira, source_instr->source_node, payload, "decls", 2); | 26240 | ZigValue *decls_value = get_const_field(ira, source_instr->source_node, payload, "decls", 2); |
| | 26241 | if (decls_value == nullptr) |
| | 26242 | return ira->codegen->invalid_inst_gen->value->type; |
| 26214 | assert(decls_value->special == ConstValSpecialStatic); | 26243 | assert(decls_value->special == ConstValSpecialStatic); |
| 26215 | assert(is_slice(decls_value->type)); | 26244 | assert(is_slice(decls_value->type)); |
| 26216 | ZigValue *decls_len_value = decls_value->data.x_struct.fields[slice_len_index]; | 26245 | ZigValue *decls_len_value = decls_value->data.x_struct.fields[slice_len_index]; |
| ... | @@ -26221,7 +26250,8 @@ static ZigType *type_info_to_type(IrAnalyze *ira, IrInst *source_instr, ZigTypeI | ... | @@ -26221,7 +26250,8 @@ static ZigType *type_info_to_type(IrAnalyze *ira, IrInst *source_instr, ZigTypeI |
| 26221 | } | 26250 | } |
| 26222 | | 26251 | |
| 26223 | bool is_tuple; | 26252 | bool is_tuple; |
| 26224 | get_const_field_bool(ira, source_instr->source_node, payload, "is_tuple", 3, &is_tuple); | 26253 | if ((err = get_const_field_bool(ira, source_instr->source_node, payload, "is_tuple", 3, &is_tuple))) |
| | 26254 | return ira->codegen->invalid_inst_gen->value->type; |
| 26225 | | 26255 | |
| 26226 | ZigType *entry = new_type_table_entry(ZigTypeIdStruct); | 26256 | ZigType *entry = new_type_table_entry(ZigTypeIdStruct); |
| 26227 | buf_init_from_buf(&entry->name, | 26257 | buf_init_from_buf(&entry->name, |
| ... | @@ -26249,6 +26279,8 @@ static ZigType *type_info_to_type(IrAnalyze *ira, IrInst *source_instr, ZigTypeI | ... | @@ -26249,6 +26279,8 @@ static ZigType *type_info_to_type(IrAnalyze *ira, IrInst *source_instr, ZigTypeI |
| 26249 | return ira->codegen->invalid_inst_gen->value->type; | 26279 | return ira->codegen->invalid_inst_gen->value->type; |
| 26250 | field->decl_node = source_instr->source_node; | 26280 | field->decl_node = source_instr->source_node; |
| 26251 | ZigValue *type_value = get_const_field(ira, source_instr->source_node, field_value, "field_type", 1); | 26281 | ZigValue *type_value = get_const_field(ira, source_instr->source_node, field_value, "field_type", 1); |
| | 26282 | if (type_value == nullptr) |
| | 26283 | return ira->codegen->invalid_inst_gen->value->type; |
| 26252 | field->type_val = type_value; | 26284 | field->type_val = type_value; |
| 26253 | field->type_entry = type_value->data.x_type; | 26285 | field->type_entry = type_value->data.x_type; |
| 26254 | if (entry->data.structure.fields_by_name.put_unique(field->name, field) != nullptr) { | 26286 | if (entry->data.structure.fields_by_name.put_unique(field->name, field) != nullptr) { |
| ... | @@ -26256,6 +26288,8 @@ static ZigType *type_info_to_type(IrAnalyze *ira, IrInst *source_instr, ZigTypeI | ... | @@ -26256,6 +26288,8 @@ static ZigType *type_info_to_type(IrAnalyze *ira, IrInst *source_instr, ZigTypeI |
| 26256 | return ira->codegen->invalid_inst_gen->value->type; | 26288 | return ira->codegen->invalid_inst_gen->value->type; |
| 26257 | } | 26289 | } |
| 26258 | ZigValue *default_value = get_const_field(ira, source_instr->source_node, field_value, "default_value", 2); | 26290 | ZigValue *default_value = get_const_field(ira, source_instr->source_node, field_value, "default_value", 2); |
| | 26291 | if (default_value == nullptr) |
| | 26292 | return ira->codegen->invalid_inst_gen->value->type; |
| 26259 | if (default_value->type->id == ZigTypeIdNull) { | 26293 | if (default_value->type->id == ZigTypeIdNull) { |
| 26260 | field->init_val = nullptr; | 26294 | field->init_val = nullptr; |
| 26261 | } else if (default_value->type->id == ZigTypeIdOptional && default_value->type->data.maybe.child_type == field->type_entry) { | 26295 | } else if (default_value->type->id == ZigTypeIdOptional && default_value->type->data.maybe.child_type == field->type_entry) { |
| ... | @@ -26278,6 +26312,9 @@ static ZigType *type_info_to_type(IrAnalyze *ira, IrInst *source_instr, ZigTypeI | ... | @@ -26278,6 +26312,9 @@ static ZigType *type_info_to_type(IrAnalyze *ira, IrInst *source_instr, ZigTypeI |
| 26278 | assert(payload->type == ir_type_info_get_type(ira, "Enum", nullptr)); | 26312 | assert(payload->type == ir_type_info_get_type(ira, "Enum", nullptr)); |
| 26279 | | 26313 | |
| 26280 | ZigValue *layout_value = get_const_field(ira, source_instr->source_node, payload, "layout", 0); | 26314 | ZigValue *layout_value = get_const_field(ira, source_instr->source_node, payload, "layout", 0); |
| | 26315 | if (layout_value == nullptr) |
| | 26316 | return ira->codegen->invalid_inst_gen->value->type; |
| | 26317 | |
| 26281 | assert(layout_value->special == ConstValSpecialStatic); | 26318 | assert(layout_value->special == ConstValSpecialStatic); |
| 26282 | assert(layout_value->type == ir_type_info_get_type(ira, "ContainerLayout", nullptr)); | 26319 | assert(layout_value->type == ir_type_info_get_type(ira, "ContainerLayout", nullptr)); |
| 26283 | ContainerLayout layout = (ContainerLayout)bigint_as_u32(&layout_value->data.x_enum_tag); | 26320 | ContainerLayout layout = (ContainerLayout)bigint_as_u32(&layout_value->data.x_enum_tag); |
| ... | @@ -26285,6 +26322,9 @@ static ZigType *type_info_to_type(IrAnalyze *ira, IrInst *source_instr, ZigTypeI | ... | @@ -26285,6 +26322,9 @@ static ZigType *type_info_to_type(IrAnalyze *ira, IrInst *source_instr, ZigTypeI |
| 26285 | ZigType *tag_type = get_const_field_meta_type(ira, source_instr->source_node, payload, "tag_type", 1); | 26322 | ZigType *tag_type = get_const_field_meta_type(ira, source_instr->source_node, payload, "tag_type", 1); |
| 26286 | | 26323 | |
| 26287 | ZigValue *fields_value = get_const_field(ira, source_instr->source_node, payload, "fields", 2); | 26324 | ZigValue *fields_value = get_const_field(ira, source_instr->source_node, payload, "fields", 2); |
| | 26325 | if (fields_value == nullptr) |
| | 26326 | return ira->codegen->invalid_inst_gen->value->type; |
| | 26327 | |
| 26288 | assert(fields_value->special == ConstValSpecialStatic); | 26328 | assert(fields_value->special == ConstValSpecialStatic); |
| 26289 | assert(is_slice(fields_value->type)); | 26329 | assert(is_slice(fields_value->type)); |
| 26290 | ZigValue *fields_ptr = fields_value->data.x_struct.fields[slice_ptr_index]; | 26330 | ZigValue *fields_ptr = fields_value->data.x_struct.fields[slice_ptr_index]; |
| ... | @@ -26292,6 +26332,9 @@ static ZigType *type_info_to_type(IrAnalyze *ira, IrInst *source_instr, ZigTypeI | ... | @@ -26292,6 +26332,9 @@ static ZigType *type_info_to_type(IrAnalyze *ira, IrInst *source_instr, ZigTypeI |
| 26292 | size_t fields_len = bigint_as_usize(&fields_len_value->data.x_bigint); | 26332 | size_t fields_len = bigint_as_usize(&fields_len_value->data.x_bigint); |
| 26293 | | 26333 | |
| 26294 | ZigValue *decls_value = get_const_field(ira, source_instr->source_node, payload, "decls", 3); | 26334 | ZigValue *decls_value = get_const_field(ira, source_instr->source_node, payload, "decls", 3); |
| | 26335 | if (decls_value == nullptr) |
| | 26336 | return ira->codegen->invalid_inst_gen->value->type; |
| | 26337 | |
| 26295 | assert(decls_value->special == ConstValSpecialStatic); | 26338 | assert(decls_value->special == ConstValSpecialStatic); |
| 26296 | assert(is_slice(decls_value->type)); | 26339 | assert(is_slice(decls_value->type)); |
| 26297 | ZigValue *decls_len_value = decls_value->data.x_struct.fields[slice_len_index]; | 26340 | ZigValue *decls_len_value = decls_value->data.x_struct.fields[slice_len_index]; |
| ... | @@ -26337,7 +26380,10 @@ static ZigType *type_info_to_type(IrAnalyze *ira, IrInst *source_instr, ZigTypeI | ... | @@ -26337,7 +26380,10 @@ static ZigType *type_info_to_type(IrAnalyze *ira, IrInst *source_instr, ZigTypeI |
| 26337 | ir_add_error(ira, source_instr, buf_sprintf("duplicate enum field '%s'", buf_ptr(field->name))); | 26380 | ir_add_error(ira, source_instr, buf_sprintf("duplicate enum field '%s'", buf_ptr(field->name))); |
| 26338 | return ira->codegen->invalid_inst_gen->value->type; | 26381 | return ira->codegen->invalid_inst_gen->value->type; |
| 26339 | } | 26382 | } |
| 26340 | field->value = *get_const_field_lit_int(ira, source_instr->source_node, field_value, "value", 1); | 26383 | BigInt *field_int_value = get_const_field_lit_int(ira, source_instr->source_node, field_value, "value", 1); |
| | 26384 | if (field_int_value == nullptr) |
| | 26385 | return ira->codegen->invalid_inst_gen->value->type; |
| | 26386 | field->value = *field_int_value; |
| 26341 | } | 26387 | } |
| 26342 | | 26388 | |
| 26343 | return entry; | 26389 | return entry; |