authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-05-07 22:46:59-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-06-10 20:42:30-07:00
logfd674d95bee4815783bb282c80ba6af369296706
treed0805bdb727b4f229272043e680d8c2ce767e620
parentad06b249b6e4253f553e7255dd5530172a14a70f

InternPool: add indexToKey for empty struct types


1 files changed, 12 insertions(+), 5 deletions(-)

src/InternPool.zig+12-5
......@@ -59,10 +59,8 @@ pub const Key = union(enum) {
5959 ty: Index,
6060 tag: BigIntConst,
6161 },
62 struct_type: struct {
63 fields_len: u32,
64 // TODO move Module.Struct data to InternPool
65 },
62 struct_type: StructType,
63
6664 union_type: struct {
6765 fields_len: u32,
6866 // TODO move Module.Union data to InternPool
......@@ -111,6 +109,11 @@ pub const Key = union(enum) {
111109 child: Index,
112110 };
113111
112 pub const StructType = struct {
113 fields_len: u32,
114 // TODO move Module.Struct data to InternPool
115 };
116
114117 pub const Int = struct {
115118 ty: Index,
116119 storage: Storage,
......@@ -1058,7 +1061,11 @@ pub fn indexToKey(ip: InternPool, index: Index) Key {
10581061
10591062 .type_error_union => @panic("TODO"),
10601063 .type_enum_simple => @panic("TODO"),
1061 .simple_internal => @panic("TODO"),
1064 .simple_internal => switch (@intToEnum(SimpleInternal, data)) {
1065 .type_empty_struct => .{ .struct_type = .{
1066 .fields_len = 0,
1067 } },
1068 },
10621069 .int_u8 => .{ .int = .{
10631070 .ty = .u8_type,
10641071 .storage = .{ .u64 = data },