mirror of
https://github.com/ziglang/zig.git
synced 2026-02-12 20:37:54 +00:00
fix AIR printing of interned constants
This commit is contained in:
parent
3e6dd0da7a
commit
80bf5af345
@ -413,8 +413,12 @@ pub fn print(
|
||||
.runtime_value => return writer.writeAll("[runtime value]"),
|
||||
},
|
||||
else => {
|
||||
try writer.print("(interned: {})", .{val.ip_index});
|
||||
return;
|
||||
const key = mod.intern_pool.indexToKey(val.ip_index);
|
||||
if (key.typeOf() == .type_type) {
|
||||
return Type.print(val.toType(), writer, mod);
|
||||
} else {
|
||||
return writer.print("{}", .{val.ip_index});
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@ -621,7 +621,7 @@ const Writer = struct {
|
||||
fn writeInterned(w: *Writer, s: anytype, inst: Air.Inst.Index) @TypeOf(s).Error!void {
|
||||
const mod = w.module;
|
||||
const ip_index = w.air.instructions.items(.data)[inst].interned;
|
||||
const ty = ip_index.toType();
|
||||
const ty = mod.intern_pool.indexToKey(ip_index).typeOf().toType();
|
||||
try w.writeType(s, ty);
|
||||
try s.print(", {}", .{ip_index.toValue().fmtValue(ty, mod)});
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user