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
commit 79958f4520
Notes: sideshowbarker 2024-07-19 05:47:44 +09:00
4 changed files with 89 additions and 15 deletions

View file

@ -147,7 +147,7 @@ Value ObjectConstructor::get_own_property_descriptor(Interpreter& interpreter)
auto property_key = interpreter.argument(1).to_string(interpreter);
if (interpreter.exception())
return {};
return object->get_own_property_descriptor(property_key);
return object->get_own_property_descriptor_object(property_key);
}
Value ObjectConstructor::define_property_(Interpreter& interpreter)