diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/bun.js/bindings/bindings.cpp | 16 | ||||
| -rw-r--r-- | src/bun.js/bindings/exports.zig | 10 |
2 files changed, 14 insertions, 12 deletions
diff --git a/src/bun.js/bindings/bindings.cpp b/src/bun.js/bindings/bindings.cpp index 63e17c189..9e0857578 100644 --- a/src/bun.js/bindings/bindings.cpp +++ b/src/bun.js/bindings/bindings.cpp @@ -3605,10 +3605,6 @@ restart: bool anyHits = false; JSC::JSObject* objectToUse = prototypeObject.getObject(); structure->forEachProperty(vm, [&](const PropertyTableEntry& entry) -> bool { - if ((entry.attributes() & PropertyAttribute::Accessor) != 0) { - return true; - } - if ((entry.attributes() & (PropertyAttribute::Function)) == 0 && (entry.attributes() & (PropertyAttribute::Builtin)) != 0) { return true; } @@ -3634,7 +3630,7 @@ restart: return true; JSC::JSValue propertyValue = objectToUse == object ? objectToUse->getDirect(entry.offset()) : JSValue(); - if (!propertyValue || propertyValue.isGetterSetter()) { + if (!propertyValue || propertyValue.isGetterSetter() && !((entry.attributes() & PropertyAttribute::Accessor) != 0)) { propertyValue = objectToUse->get(globalObject, prop); } @@ -3693,10 +3689,6 @@ restart: if (!object->getPropertySlot(globalObject, property, slot)) continue; - if ((slot.attributes() & PropertyAttribute::Accessor) != 0) { - continue; - } - if ((slot.attributes() & PropertyAttribute::DontEnum) != 0) { if (property == vm.propertyNames->length || property == vm.propertyNames->underscoreProto @@ -3716,7 +3708,9 @@ restart: JSC::JSValue propertyValue = jsUndefined(); if ((slot.attributes() & PropertyAttribute::DontEnum) != 0) { - if (slot.attributes() & PropertyAttribute::BuiltinOrFunction) { + if ((slot.attributes() & PropertyAttribute::Accessor) != 0) { + propertyValue = slot.getPureResult(); + } else if (slot.attributes() & PropertyAttribute::BuiltinOrFunction) { propertyValue = slot.getValue(globalObject, property); } else if (slot.isCustom()) { propertyValue = slot.getValue(globalObject, property); @@ -3725,6 +3719,8 @@ restart: } else if (object->getOwnPropertySlot(object, globalObject, property, slot)) { propertyValue = slot.getValue(globalObject, property); } + } else if ((slot.attributes() & PropertyAttribute::Accessor) != 0) { + propertyValue = slot.getPureResult(); } else { propertyValue = slot.getValue(globalObject, property); } diff --git a/src/bun.js/bindings/exports.zig b/src/bun.js/bindings/exports.zig index 704dd6ae0..d4401865d 100644 --- a/src/bun.js/bindings/exports.zig +++ b/src/bun.js/bindings/exports.zig @@ -1268,6 +1268,8 @@ pub const ZigConsoleClient = struct { JSX, Event, + Getter, + pub fn isPrimitive(this: Tag) bool { return switch (this) { .String, @@ -1433,8 +1435,6 @@ pub const ZigConsoleClient = struct { // None of these should ever exist here // But we're going to check anyway - .GetterSetter, - .CustomGetterSetter, .APIValueWrapper, .NativeExecutable, .ProgramExecutable, @@ -1461,6 +1461,8 @@ pub const ZigConsoleClient = struct { .Event => .Event, + .GetterSetter, .CustomGetterSetter => .Getter, + else => .JSON, }, .cell = js_type, @@ -2032,6 +2034,9 @@ pub const ZigConsoleClient = struct { writer.print(comptime Output.prettyFmt("<cyan>[Function<d>:<r> <cyan>{}]<r>", enable_ansi_colors), .{printable}); } }, + .Getter => { + writer.print(comptime Output.prettyFmt("<cyan>[Getter]<r>", enable_ansi_colors), .{}); + }, .Array => { const len = @truncate(u32, value.getLengthOfArray(this.globalThis)); if (len == 0) { @@ -2800,6 +2805,7 @@ pub const ZigConsoleClient = struct { .NativeCode => this.printAs(.NativeCode, Writer, writer, value, result.cell, enable_ansi_colors), .JSX => this.printAs(.JSX, Writer, writer, value, result.cell, enable_ansi_colors), .Event => this.printAs(.Event, Writer, writer, value, result.cell, enable_ansi_colors), + .Getter => this.printAs(.Getter, Writer, writer, value, result.cell, enable_ansi_colors), }; } }; |
