From fd674d95bee4815783bb282c80ba6af369296706 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Sun, 7 May 2023 22:46:59 -0700 Subject: [PATCH] InternPool: add indexToKey for empty struct types --- src/InternPool.zig | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/InternPool.zig b/src/InternPool.zig index 4f2e792a4968648c526f30e6acf2d1b677e63741..a49b98bd50de498c0bb8699feec0407f5de19a6e 100644 --- a/src/InternPool.zig +++ b/src/InternPool.zig @@ -59,10 +59,8 @@ pub const Key = union(enum) { ty: Index, tag: BigIntConst, }, - struct_type: struct { - fields_len: u32, - // TODO move Module.Struct data to InternPool - }, + struct_type: StructType, + union_type: struct { fields_len: u32, // TODO move Module.Union data to InternPool @@ -111,6 +109,11 @@ pub const Key = union(enum) { child: Index, }; + pub const StructType = struct { + fields_len: u32, + // TODO move Module.Struct data to InternPool + }; + pub const Int = struct { ty: Index, storage: Storage, @@ -1058,7 +1061,11 @@ pub fn indexToKey(ip: InternPool, index: Index) Key { .type_error_union => @panic("TODO"), .type_enum_simple => @panic("TODO"), - .simple_internal => @panic("TODO"), + .simple_internal => switch (@intToEnum(SimpleInternal, data)) { + .type_empty_struct => .{ .struct_type = .{ + .fields_len = 0, + } }, + }, .int_u8 => .{ .int = .{ .ty = .u8_type, .storage = .{ .u64 = data }, -- 2.54.0