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) {...@@ -59,10 +59,8 @@ pub const Key = union(enum) {
59 ty: Index,59 ty: Index,
60 tag: BigIntConst,60 tag: BigIntConst,
61 },61 },
62 struct_type: struct {62 struct_type: StructType,
63 fields_len: u32,63
64 // TODO move Module.Struct data to InternPool
65 },
66 union_type: struct {64 union_type: struct {
67 fields_len: u32,65 fields_len: u32,
68 // TODO move Module.Union data to InternPool66 // TODO move Module.Union data to InternPool
...@@ -111,6 +109,11 @@ pub const Key = union(enum) {...@@ -111,6 +109,11 @@ pub const Key = union(enum) {
111 child: Index,109 child: Index,
112 };110 };
113111
112 pub const StructType = struct {
113 fields_len: u32,
114 // TODO move Module.Struct data to InternPool
115 };
116
114 pub const Int = struct {117 pub const Int = struct {
115 ty: Index,118 ty: Index,
116 storage: Storage,119 storage: Storage,
...@@ -1058,7 +1061,11 @@ pub fn indexToKey(ip: InternPool, index: Index) Key {...@@ -1058,7 +1061,11 @@ pub fn indexToKey(ip: InternPool, index: Index) Key {
10581061
1059 .type_error_union => @panic("TODO"),1062 .type_error_union => @panic("TODO"),
1060 .type_enum_simple => @panic("TODO"),1063 .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 },
1062 .int_u8 => .{ .int = .{1069 .int_u8 => .{ .int = .{
1063 .ty = .u8_type,1070 .ty = .u8_type,
1064 .storage = .{ .u64 = data },1071 .storage = .{ .u64 = data },