1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-25 22:35:07 +00:00

LibJS: Add PropertyDescriptor object

This new struct is now returned from get_own_property_descriptor. To
preserve the old functionality of returning an object, there is now a
get_own_property_descriptor_object method, for use in
{Object,Reflect}.getOwnPropertyDescriptor().

This change will be useful for the implementation of Proxies, which do a
lot of descriptor checks. We want to avoid as many object gets and puts
as possible.
This commit is contained in:
Matthew Olsson 2020-06-03 09:40:17 -07:00 committed by Andreas Kling
parent 5ad5322f6a
commit 79958f4520
4 changed files with 89 additions and 15 deletions

View file

@ -189,7 +189,7 @@ Value ReflectObject::get_own_property_descriptor(Interpreter& interpreter)
auto property_key = interpreter.argument(1).to_string(interpreter);
if (interpreter.exception())
return {};
return target->get_own_property_descriptor(property_key);
return target->get_own_property_descriptor_object(property_key);
}
Value ReflectObject::get_prototype_of(Interpreter& interpreter)