1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 07:58:11 +00:00

LibJS: Convert to_property_descriptor() to ThrowCompletionOr

Also add spec step comments to it while we're here.
This commit is contained in:
Linus Groh 2021-10-03 20:07:00 +01:00
parent 2f42675ebd
commit d7d73f9100
6 changed files with 85 additions and 46 deletions

View file

@ -117,9 +117,7 @@ JS_DEFINE_NATIVE_FUNCTION(ReflectObject::define_property)
return {};
// 3. Let desc be ? ToPropertyDescriptor(attributes).
auto descriptor = to_property_descriptor(global_object, attributes);
if (vm.exception())
return {};
auto descriptor = TRY_OR_DISCARD(to_property_descriptor(global_object, attributes));
// 4. Return ? target.[[DefineOwnProperty]](key, desc).
return Value(TRY_OR_DISCARD(target.as_object().internal_define_own_property(key, descriptor)));