| ... | ... | @@ -130,16 +130,23 @@ pub fn print( |
| 130 | 130 | inline else => |x| try writer.print("{d}", .{@as(f64, @floatCast(x))}), |
| 131 | 131 | }, |
| 132 | 132 | .slice => |slice| { |
| 133 | | const print_contents = switch (ip.getBackingAddrTag(slice.ptr).?) { |
| 134 | | .field, .arr_elem, .eu_payload, .opt_payload => unreachable, |
| 135 | | .uav, .comptime_alloc, .comptime_field => true, |
| 136 | | .nav, .int => false, |
| 137 | | }; |
| 138 | | if (print_contents) { |
| 139 | | // TODO: eventually we want to load the slice as an array with `sema`, but that's |
| 140 | | // currently not possible without e.g. triggering compile errors. |
| 133 | if (ip.isUndef(slice.ptr)) { |
| 134 | if (slice.len == .zero_usize) { |
| 135 | return writer.writeAll("&.{}"); |
| 136 | } |
| 137 | try print(.fromInterned(slice.ptr), writer, level - 1, pt, opt_sema); |
| 138 | } else { |
| 139 | const print_contents = switch (ip.getBackingAddrTag(slice.ptr).?) { |
| 140 | .field, .arr_elem, .eu_payload, .opt_payload => unreachable, |
| 141 | .uav, .comptime_alloc, .comptime_field => true, |
| 142 | .nav, .int => false, |
| 143 | }; |
| 144 | if (print_contents) { |
| 145 | // TODO: eventually we want to load the slice as an array with `sema`, but that's |
| 146 | // currently not possible without e.g. triggering compile errors. |
| 147 | } |
| 148 | try printPtr(Value.fromInterned(slice.ptr), null, writer, level, pt, opt_sema); |
| 141 | 149 | } |
| 142 | | try printPtr(Value.fromInterned(slice.ptr), null, writer, level, pt, opt_sema); |
| 143 | 150 | try writer.writeAll("[0.."); |
| 144 | 151 | if (level == 0) { |
| 145 | 152 | try writer.writeAll("(...)"); |