From 65d43ecaba7bbea9a829285ef8cf51d7f461cbf3 Mon Sep 17 00:00:00 2001 From: Benoit Giannangeli Date: Sun, 21 Jul 2024 19:21:19 +0200 Subject: [PATCH] fix: Again fixing default value printing --- src/buzz_api.zig | 2 +- src/disassembler.zig | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/buzz_api.zig b/src/buzz_api.zig index 4b25a729..077342ed 100644 --- a/src/buzz_api.zig +++ b/src/buzz_api.zig @@ -282,7 +282,7 @@ fn valueDump(value: Value, vm: *VM, seen: *std.AutoHashMap(*_obj.Obj, void), dep if (if (field.static) object.fields[field.index] - else if (!field.method) + else if (field.has_default) object.defaults[field.index] else null) |v| diff --git a/src/disassembler.zig b/src/disassembler.zig index 47b6f10d..4ee95bdf 100644 --- a/src/disassembler.zig +++ b/src/disassembler.zig @@ -596,7 +596,13 @@ pub const DumpState = struct { }, ) catch unreachable; - if (object.defaults[field.index]) |v| { + if (if (field.static) + object.fields[field.index] + else if (field.has_default) + object.defaults[field.index] + else + null) |v| + { out.print(" = ", .{}) catch unreachable; state.valueDump( v,