| ... | @@ -2625,24 +2625,36 @@ pub fn indexToKey(ip: *const InternPool, index: Index) Key { | ... | @@ -2625,24 +2625,36 @@ pub fn indexToKey(ip: *const InternPool, index: Index) Key { |
| 2625 | } }; | 2625 | } }; |
| 2626 | }, | 2626 | }, |
| 2627 | .ptr_elem => { | 2627 | .ptr_elem => { |
| | 2628 | // Avoid `indexToKey` recursion by asserting the tag encoding. |
| 2628 | const info = ip.extraData(PtrBaseIndex, data); | 2629 | const info = ip.extraData(PtrBaseIndex, data); |
| 2629 | return .{ .ptr = .{ | 2630 | const index_item = ip.items.get(@enumToInt(info.index)); |
| 2630 | .ty = info.ty, | 2631 | return switch (index_item.tag) { |
| 2631 | .addr = .{ .elem = .{ | 2632 | .int_usize => .{ .ptr = .{ |
| 2632 | .base = info.base, | 2633 | .ty = info.ty, |
| 2633 | .index = ip.indexToKey(info.index).int.storage.u64, | 2634 | .addr = .{ .elem = .{ |
| | 2635 | .base = info.base, |
| | 2636 | .index = index_item.data, |
| | 2637 | } }, |
| 2634 | } }, | 2638 | } }, |
| 2635 | } }; | 2639 | .int_positive => @panic("TODO"), // implement along with behavior test coverage |
| | 2640 | else => unreachable, |
| | 2641 | }; |
| 2636 | }, | 2642 | }, |
| 2637 | .ptr_field => { | 2643 | .ptr_field => { |
| | 2644 | // Avoid `indexToKey` recursion by asserting the tag encoding. |
| 2638 | const info = ip.extraData(PtrBaseIndex, data); | 2645 | const info = ip.extraData(PtrBaseIndex, data); |
| 2639 | return .{ .ptr = .{ | 2646 | const index_item = ip.items.get(@enumToInt(info.index)); |
| 2640 | .ty = info.ty, | 2647 | return switch (index_item.tag) { |
| 2641 | .addr = .{ .field = .{ | 2648 | .int_usize => .{ .ptr = .{ |
| 2642 | .base = info.base, | 2649 | .ty = info.ty, |
| 2643 | .index = ip.indexToKey(info.index).int.storage.u64, | 2650 | .addr = .{ .field = .{ |
| | 2651 | .base = info.base, |
| | 2652 | .index = index_item.data, |
| | 2653 | } }, |
| 2644 | } }, | 2654 | } }, |
| 2645 | } }; | 2655 | .int_positive => @panic("TODO"), // implement along with behavior test coverage |
| | 2656 | else => unreachable, |
| | 2657 | }; |
| 2646 | }, | 2658 | }, |
| 2647 | .ptr_slice => { | 2659 | .ptr_slice => { |
| 2648 | const info = ip.extraData(PtrSlice, data); | 2660 | const info = ip.extraData(PtrSlice, data); |