1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 09:38: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

@ -334,9 +334,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::define_property)
auto key = vm.argument(1).to_property_key(global_object);
if (vm.exception())
return {};
auto descriptor = to_property_descriptor(global_object, vm.argument(2));
if (vm.exception())
return {};
auto descriptor = TRY_OR_DISCARD(to_property_descriptor(global_object, vm.argument(2)));
TRY_OR_DISCARD(vm.argument(0).as_object().define_property_or_throw(key, descriptor));
return vm.argument(0);
}