mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 12:47:35 +00:00
LibJS: Remove the non-standard get_own_property_descriptor helper
This commit is contained in:
parent
8a295299f3
commit
8195c31965
2 changed files with 8 additions and 2 deletions
|
@ -125,7 +125,6 @@ public:
|
||||||
// - Helpers using old, non-standard names but wrapping the standard methods.
|
// - Helpers using old, non-standard names but wrapping the standard methods.
|
||||||
// FIXME: Update all the code relying on these and remove them.
|
// FIXME: Update all the code relying on these and remove them.
|
||||||
bool put(PropertyName const& property_name, Value value, Value receiver = {}) { return internal_set(property_name, value, receiver.value_or(this)); }
|
bool put(PropertyName const& property_name, Value value, Value receiver = {}) { return internal_set(property_name, value, receiver.value_or(this)); }
|
||||||
Optional<PropertyDescriptor> get_own_property_descriptor(PropertyName const& property_name) const { return internal_get_own_property(property_name); }
|
|
||||||
bool define_property(PropertyName const& property_name, Value value, PropertyAttributes attributes = default_attributes, bool = true)
|
bool define_property(PropertyName const& property_name, Value value, PropertyAttributes attributes = default_attributes, bool = true)
|
||||||
{
|
{
|
||||||
return internal_define_own_property(property_name, { .value = value, .writable = attributes.is_writable(), .enumerable = attributes.is_enumerable(), .configurable = attributes.is_configurable() });
|
return internal_define_own_property(property_name, { .value = value, .writable = attributes.is_writable(), .enumerable = attributes.is_enumerable(), .configurable = attributes.is_configurable() });
|
||||||
|
|
|
@ -127,15 +127,22 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectPrototype::value_of)
|
||||||
// 20.1.3.4 Object.prototype.propertyIsEnumerable ( V ), https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
|
// 20.1.3.4 Object.prototype.propertyIsEnumerable ( V ), https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
|
||||||
JS_DEFINE_NATIVE_FUNCTION(ObjectPrototype::property_is_enumerable)
|
JS_DEFINE_NATIVE_FUNCTION(ObjectPrototype::property_is_enumerable)
|
||||||
{
|
{
|
||||||
|
// 1. Let P be ? ToPropertyKey(V).
|
||||||
auto property_key = vm.argument(0).to_property_key(global_object);
|
auto property_key = vm.argument(0).to_property_key(global_object);
|
||||||
if (vm.exception())
|
if (vm.exception())
|
||||||
return {};
|
return {};
|
||||||
|
// 2. Let O be ? ToObject(this value).
|
||||||
auto* this_object = vm.this_value(global_object).to_object(global_object);
|
auto* this_object = vm.this_value(global_object).to_object(global_object);
|
||||||
if (!this_object)
|
if (!this_object)
|
||||||
return {};
|
return {};
|
||||||
auto property_descriptor = this_object->get_own_property_descriptor(property_key);
|
// 3. Let desc be ? O.[[GetOwnProperty]](P).
|
||||||
|
auto property_descriptor = this_object->internal_get_own_property(property_key);
|
||||||
|
if (vm.exception())
|
||||||
|
return {};
|
||||||
|
// 4. If desc is undefined, return false.
|
||||||
if (!property_descriptor.has_value())
|
if (!property_descriptor.has_value())
|
||||||
return Value(false);
|
return Value(false);
|
||||||
|
// 5. Return desc.[[Enumerable]].
|
||||||
return Value(*property_descriptor->enumerable);
|
return Value(*property_descriptor->enumerable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue