| ... | ... | @@ -2899,7 +2899,17 @@ pub fn indexToKey(ip: *const InternPool, index: Index) Key { |
| 2899 | 2899 | const ty = @intToEnum(Index, data); |
| 2900 | 2900 | const ty_item = ip.items.get(@enumToInt(ty)); |
| 2901 | 2901 | return switch (ty_item.tag) { |
| 2902 | | .type_array_big, .type_array_small, .type_vector => .{ .aggregate = .{ |
| 2902 | .type_array_big => { |
| 2903 | const sentinel = @ptrCast( |
| 2904 | *const [1]Index, |
| 2905 | &ip.extra.items[ty_item.data + std.meta.fieldIndex(Array, "sentinel").?], |
| 2906 | ); |
| 2907 | return .{ .aggregate = .{ |
| 2908 | .ty = ty, |
| 2909 | .storage = .{ .elems = sentinel[0..@boolToInt(sentinel[0] != .none)] }, |
| 2910 | } }; |
| 2911 | }, |
| 2912 | .type_array_small, .type_vector => .{ .aggregate = .{ |
| 2903 | 2913 | .ty = ty, |
| 2904 | 2914 | .storage = .{ .elems = &.{} }, |
| 2905 | 2915 | } }, |
| ... | ... | @@ -4799,11 +4809,9 @@ pub fn isAggregateType(ip: *const InternPool, ty: Index) bool { |
| 4799 | 4809 | |
| 4800 | 4810 | /// The is only legal because the initializer is not part of the hash. |
| 4801 | 4811 | pub fn mutateVarInit(ip: *InternPool, index: Index, init_index: Index) void { |
| 4802 | | assert(ip.items.items(.tag)[@enumToInt(index)] == .variable); |
| 4803 | | const field_index = inline for (@typeInfo(Tag.Variable).Struct.fields, 0..) |field, field_index| { |
| 4804 | | if (comptime std.mem.eql(u8, field.name, "init")) break field_index; |
| 4805 | | } else unreachable; |
| 4806 | | ip.extra.items[ip.items.items(.data)[@enumToInt(index)] + field_index] = @enumToInt(init_index); |
| 4812 | const item = ip.items.get(@enumToInt(index)); |
| 4813 | assert(item.tag == .variable); |
| 4814 | ip.extra.items[item.data + std.meta.fieldIndex(Tag.Variable, "init").?] = @enumToInt(init_index); |
| 4807 | 4815 | } |
| 4808 | 4816 | |
| 4809 | 4817 | pub fn dump(ip: *const InternPool) void { |