| ... | @@ -2573,12 +2573,14 @@ pub const Type = extern union { | ... | @@ -2573,12 +2573,14 @@ pub const Type = extern union { |
| 2573 | | 2573 | |
| 2574 | pub fn unionFields(ty: Type) Module.Union.Fields { | 2574 | pub fn unionFields(ty: Type) Module.Union.Fields { |
| 2575 | const union_obj = ty.cast(Payload.Union).?.data; | 2575 | const union_obj = ty.cast(Payload.Union).?.data; |
| | 2576 | assert(union_obj.haveFieldTypes()); |
| 2576 | return union_obj.fields; | 2577 | return union_obj.fields; |
| 2577 | } | 2578 | } |
| 2578 | | 2579 | |
| 2579 | pub fn unionFieldType(ty: Type, enum_tag: Value) Type { | 2580 | pub fn unionFieldType(ty: Type, enum_tag: Value) Type { |
| 2580 | const union_obj = ty.cast(Payload.Union).?.data; | 2581 | const union_obj = ty.cast(Payload.Union).?.data; |
| 2581 | const index = union_obj.tag_ty.enumTagFieldIndex(enum_tag).?; | 2582 | const index = union_obj.tag_ty.enumTagFieldIndex(enum_tag).?; |
| | 2583 | assert(union_obj.haveFieldTypes()); |
| 2582 | return union_obj.fields.values()[index].ty; | 2584 | return union_obj.fields.values()[index].ty; |
| 2583 | } | 2585 | } |
| 2584 | | 2586 | |
| ... | @@ -3376,6 +3378,7 @@ pub const Type = extern union { | ... | @@ -3376,6 +3378,7 @@ pub const Type = extern union { |
| 3376 | .empty_struct => return .{}, | 3378 | .empty_struct => return .{}, |
| 3377 | .@"struct" => { | 3379 | .@"struct" => { |
| 3378 | const struct_obj = ty.castTag(.@"struct").?.data; | 3380 | const struct_obj = ty.castTag(.@"struct").?.data; |
| | 3381 | assert(struct_obj.haveFieldTypes()); |
| 3379 | return struct_obj.fields; | 3382 | return struct_obj.fields; |
| 3380 | }, | 3383 | }, |
| 3381 | else => unreachable, | 3384 | else => unreachable, |