1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 07:07:34 +00:00

LibJS: Make Object::ordinary_set_with_own_descriptor non-static

This needs to be accessible for implementing IDL legacy platform
objects.
This commit is contained in:
Luke Wilde 2021-09-24 19:39:01 +01:00 committed by Andreas Kling
parent 27dfd0170e
commit e06762f312
2 changed files with 6 additions and 6 deletions

View file

@ -706,8 +706,6 @@ Value Object::internal_get(PropertyName const& property_name, Value receiver) co
return TRY_OR_DISCARD(vm.call(*getter, receiver)); return TRY_OR_DISCARD(vm.call(*getter, receiver));
} }
static bool ordinary_set_with_own_descriptor(Object&, PropertyName const&, Value, Value, Optional<PropertyDescriptor>);
// 10.1.9 [[Set]] ( P, V, Receiver ), https://tc39.es/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots-set-p-v-receiver // 10.1.9 [[Set]] ( P, V, Receiver ), https://tc39.es/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots-set-p-v-receiver
bool Object::internal_set(PropertyName const& property_name, Value value, Value receiver) bool Object::internal_set(PropertyName const& property_name, Value value, Value receiver)
{ {
@ -724,13 +722,13 @@ bool Object::internal_set(PropertyName const& property_name, Value value, Value
return {}; return {};
// 3. Return OrdinarySetWithOwnDescriptor(O, P, V, Receiver, ownDesc). // 3. Return OrdinarySetWithOwnDescriptor(O, P, V, Receiver, ownDesc).
return ordinary_set_with_own_descriptor(*this, property_name, value, receiver, own_descriptor); return ordinary_set_with_own_descriptor(property_name, value, receiver, own_descriptor);
} }
// 10.1.9.2 OrdinarySetWithOwnDescriptor ( O, P, V, Receiver, ownDesc ), https://tc39.es/ecma262/#sec-ordinarysetwithowndescriptor // 10.1.9.2 OrdinarySetWithOwnDescriptor ( O, P, V, Receiver, ownDesc ), https://tc39.es/ecma262/#sec-ordinarysetwithowndescriptor
bool ordinary_set_with_own_descriptor(Object& object, PropertyName const& property_name, Value value, Value receiver, Optional<PropertyDescriptor> own_descriptor) bool Object::ordinary_set_with_own_descriptor(PropertyName const& property_name, Value value, Value receiver, Optional<PropertyDescriptor> own_descriptor)
{ {
auto& vm = object.vm(); auto& vm = this->vm();
// 1. Assert: IsPropertyKey(P) is true. // 1. Assert: IsPropertyKey(P) is true.
VERIFY(property_name.is_valid()); VERIFY(property_name.is_valid());
@ -738,7 +736,7 @@ bool ordinary_set_with_own_descriptor(Object& object, PropertyName const& proper
// 2. If ownDesc is undefined, then // 2. If ownDesc is undefined, then
if (!own_descriptor.has_value()) { if (!own_descriptor.has_value()) {
// a. Let parent be ? O.[[GetPrototypeOf]](). // a. Let parent be ? O.[[GetPrototypeOf]]().
auto parent = object.internal_get_prototype_of(); auto parent = internal_get_prototype_of();
if (vm.exception()) if (vm.exception())
return {}; return {};

View file

@ -102,6 +102,8 @@ public:
virtual bool internal_delete(PropertyName const&); virtual bool internal_delete(PropertyName const&);
virtual MarkedValueList internal_own_property_keys() const; virtual MarkedValueList internal_own_property_keys() const;
bool ordinary_set_with_own_descriptor(PropertyName const&, Value, Value, Optional<PropertyDescriptor>);
// 10.4.7 Immutable Prototype Exotic Objects, https://tc39.es/ecma262/#sec-immutable-prototype-exotic-objects // 10.4.7 Immutable Prototype Exotic Objects, https://tc39.es/ecma262/#sec-immutable-prototype-exotic-objects
bool set_immutable_prototype(Object* prototype); bool set_immutable_prototype(Object* prototype);