Fix method parameter attribute name

This commit is contained in:
ktkk 2026-07-08 19:24:29 +02:00
parent a47405e903
commit 76c436714f

View file

@ -2289,13 +2289,15 @@ pub const MethodParameters = struct {
try w.print("flags: {f}\n", .{ self.access_flags }); try w.print("flags: {f}\n", .{ self.access_flags });
const name_ = self.name(constant_pool) catch return error.WriteFailed; const name_ = self.name(constant_pool) catch return error.WriteFailed;
try w.splatByteAll(' ', depth * indent); if (name_) |n| {
_ = try w.write("name:\n"); try w.splatByteAll(' ', depth * indent);
try name_.indentedFormat(w, depth, indent + 1, constant_pool); _ = try w.write("name:\n");
try n.indentedFormat(w, depth, indent + 1, constant_pool);
}
} }
pub fn name(self: *const Parameter, constant_pool: ConstantPool) ResolveError!ConstantPool.Info { pub fn name(self: *const Parameter, constant_pool: ConstantPool) ResolveError!?ConstantPool.Info {
return constant_pool.getTag(self.name_index, .utf8); return constant_pool.getTagOptional(self.name_index, .utf8);
} }
}; };