@@ -771,23 +771,9 @@ static void ira_deref(IrAnalyze *ira) {
771
771
destroy(ira, "IrAnalyze");
772
772
}
773
773
774
- static ZigValue *const_ptr_pointee_unchecked (CodeGen *g, ZigValue *const_val) {
774
+ static ZigValue *const_ptr_pointee_unchecked_no_isf (CodeGen *g, ZigValue *const_val) {
775
775
assert(get_src_ptr_type(const_val->type) != nullptr);
776
776
assert(const_val->special == ConstValSpecialStatic);
777
- ZigValue *result;
778
-
779
- InferredStructField *isf = const_val->type->data.pointer.inferred_struct_field;
780
- if (isf != nullptr) {
781
- TypeStructField *field = find_struct_type_field(isf->inferred_struct_type, isf->field_name);
782
- assert(field != nullptr);
783
- if (field->is_comptime) {
784
- assert(field->init_val != nullptr);
785
- return field->init_val;
786
- }
787
- assert(const_val->data.x_ptr.special == ConstPtrSpecialRef);
788
- ZigValue *struct_val = const_val->data.x_ptr.data.ref.pointee;
789
- return struct_val->data.x_struct.fields[field->src_index];
790
- }
791
777
792
778
switch (type_has_one_possible_value(g, const_val->type->data.pointer.child_type)) {
793
779
case OnePossibleValueInvalid:
@@ -798,6 +784,7 @@ static ZigValue *const_ptr_pointee_unchecked(CodeGen *g, ZigValue *const_val) {
798
784
break;
799
785
}
800
786
787
+ ZigValue *result;
801
788
switch (const_val->data.x_ptr.special) {
802
789
case ConstPtrSpecialInvalid:
803
790
zig_unreachable();
@@ -843,6 +830,26 @@ static ZigValue *const_ptr_pointee_unchecked(CodeGen *g, ZigValue *const_val) {
843
830
return result;
844
831
}
845
832
833
+ static ZigValue *const_ptr_pointee_unchecked(CodeGen *g, ZigValue *const_val) {
834
+ assert(get_src_ptr_type(const_val->type) != nullptr);
835
+ assert(const_val->special == ConstValSpecialStatic);
836
+
837
+ InferredStructField *isf = const_val->type->data.pointer.inferred_struct_field;
838
+ if (isf != nullptr) {
839
+ TypeStructField *field = find_struct_type_field(isf->inferred_struct_type, isf->field_name);
840
+ assert(field != nullptr);
841
+ if (field->is_comptime) {
842
+ assert(field->init_val != nullptr);
843
+ return field->init_val;
844
+ }
845
+ ZigValue *struct_val = const_ptr_pointee_unchecked_no_isf(g, const_val);
846
+ assert(struct_val->type->id == ZigTypeIdStruct);
847
+ return struct_val->data.x_struct.fields[field->src_index];
848
+ }
849
+
850
+ return const_ptr_pointee_unchecked_no_isf(g, const_val);
851
+ }
852
+
846
853
static bool is_tuple(ZigType *type) {
847
854
return type->id == ZigTypeIdStruct && type->data.structure.special == StructSpecialInferredTuple;
848
855
}
0 commit comments