Dump constant pool in debug mode
This commit is contained in:
parent
a18ae9c265
commit
07d43f2fe7
5 changed files with 77 additions and 42 deletions
|
|
@ -51,7 +51,7 @@ pub fn deinit(self: *Self, allocator: std.mem.Allocator) void {
|
|||
allocator.free(self.attributes);
|
||||
}
|
||||
|
||||
pub fn format(
|
||||
pub fn indentedFormat(
|
||||
self: *const Self,
|
||||
w: *std.Io.Writer,
|
||||
depth: usize,
|
||||
|
|
@ -65,12 +65,12 @@ pub fn format(
|
|||
try w.splatByteAll(' ', depth * indent);
|
||||
_ = try w.write("name:\n");
|
||||
const method_name = self.name(constant_pool) catch return error.WriteFailed;
|
||||
try method_name.format(w, depth, indent + 1, constant_pool);
|
||||
try method_name.indentedFormat(w, depth, indent + 1, constant_pool);
|
||||
|
||||
try w.splatByteAll(' ', depth * indent);
|
||||
_ = try w.write("descriptor:\n");
|
||||
const method_descriptor = self.descriptor(constant_pool) catch return error.WriteFailed;
|
||||
try method_descriptor.format(w, depth, indent + 1, constant_pool);
|
||||
try method_descriptor.indentedFormat(w, depth, indent + 1, constant_pool);
|
||||
|
||||
try w.splatByteAll(' ', depth * indent);
|
||||
_ = try w.write("attributes:\n");
|
||||
|
|
@ -82,7 +82,7 @@ pub fn format(
|
|||
try w.splatByteAll(' ', depth * attr_indent);
|
||||
try w.print("{d}:\n", .{ j });
|
||||
|
||||
try attribute.format(w, depth, attr_indent + 1, allocator, constant_pool);
|
||||
try attribute.indentedFormat(w, depth, attr_indent + 1, allocator, constant_pool);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue