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
commit d7d73f9100
Notes: sideshowbarker 2024-07-18 03:06:20 +09:00
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);
}