| ... | ... | @@ -1383,7 +1383,7 @@ pub const Index = enum(u32) { |
| 1383 | 1383 | ptr_elem: struct { data: *PtrBaseIndex }, |
| 1384 | 1384 | ptr_field: struct { data: *PtrBaseIndex }, |
| 1385 | 1385 | ptr_slice: struct { data: *PtrSlice }, |
| 1386 | | opt_payload: DataIsIndex, |
| 1386 | opt_payload: struct { data: *TypeValue }, |
| 1387 | 1387 | opt_null: DataIsIndex, |
| 1388 | 1388 | int_u8: struct { data: u8 }, |
| 1389 | 1389 | int_u16: struct { data: u16 }, |
| ... | ... | @@ -1807,9 +1807,8 @@ pub const Tag = enum(u8) { |
| 1807 | 1807 | /// already contains the slice type corresponding to this payload. |
| 1808 | 1808 | ptr_slice, |
| 1809 | 1809 | /// An optional value that is non-null. |
| 1810 | | /// data is Index of the payload value. |
| 1811 | | /// In order to use this encoding, one must ensure that the `InternPool` |
| 1812 | | /// already contains the optional type corresponding to this payload. |
| 1810 | /// data is extra index of `TypeValue`. |
| 1811 | /// The type is the optional type (not the payload type). |
| 1813 | 1812 | opt_payload, |
| 1814 | 1813 | /// An optional value that is null. |
| 1815 | 1814 | /// data is Index of the optional type. |
| ... | ... | @@ -2577,15 +2576,10 @@ pub fn indexToKey(ip: *const InternPool, index: Index) Key { |
| 2577 | 2576 | .val = .none, |
| 2578 | 2577 | } }, |
| 2579 | 2578 | .opt_payload => { |
| 2580 | | const payload_val = @intToEnum(Index, data); |
| 2581 | | // The existence of `opt_payload` guarantees that the optional type will be |
| 2582 | | // stored in the `InternPool`. |
| 2583 | | const opt_ty = ip.getAssumeExists(.{ |
| 2584 | | .opt_type = ip.typeOf(payload_val), |
| 2585 | | }); |
| 2579 | const extra = ip.extraData(TypeValue, data); |
| 2586 | 2580 | return .{ .opt = .{ |
| 2587 | | .ty = opt_ty, |
| 2588 | | .val = payload_val, |
| 2581 | .ty = extra.ty, |
| 2582 | .val = extra.val, |
| 2589 | 2583 | } }; |
| 2590 | 2584 | }, |
| 2591 | 2585 | .ptr_decl => { |
| ... | ... | @@ -3375,7 +3369,10 @@ pub fn get(ip: *InternPool, gpa: Allocator, key: Key) Allocator.Error!Index { |
| 3375 | 3369 | .data = @enumToInt(opt.ty), |
| 3376 | 3370 | } else .{ |
| 3377 | 3371 | .tag = .opt_payload, |
| 3378 | | .data = @enumToInt(opt.val), |
| 3372 | .data = try ip.addExtra(gpa, TypeValue{ |
| 3373 | .ty = opt.ty, |
| 3374 | .val = opt.val, |
| 3375 | }), |
| 3379 | 3376 | }); |
| 3380 | 3377 | }, |
| 3381 | 3378 | |
| ... | ... | @@ -4800,7 +4797,7 @@ fn dumpFallible(ip: InternPool, arena: Allocator) anyerror!void { |
| 4800 | 4797 | .ptr_field => @sizeOf(PtrBaseIndex), |
| 4801 | 4798 | .ptr_slice => @sizeOf(PtrSlice), |
| 4802 | 4799 | .opt_null => 0, |
| 4803 | | .opt_payload => 0, |
| 4800 | .opt_payload => @sizeOf(TypeValue), |
| 4804 | 4801 | .int_u8 => 0, |
| 4805 | 4802 | .int_u16 => 0, |
| 4806 | 4803 | .int_u32 => 0, |