mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:28:10 +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:
parent
2f42675ebd
commit
d7d73f9100
6 changed files with 85 additions and 46 deletions
|
@ -677,7 +677,6 @@ ThrowCompletionOr<bool> Object::internal_set(PropertyName const& property_name,
|
|||
{
|
||||
VERIFY(!value.is_empty());
|
||||
VERIFY(!receiver.is_empty());
|
||||
auto& vm = this->vm();
|
||||
|
||||
// 1. Assert: IsPropertyKey(P) is true.
|
||||
VERIFY(property_name.is_valid());
|
||||
|
@ -1069,9 +1068,7 @@ ThrowCompletionOr<Object*> Object::define_properties(Value properties)
|
|||
auto descriptor_object = TRY(props->get(property_name));
|
||||
|
||||
// ii. Let desc be ? ToPropertyDescriptor(descObj).
|
||||
auto descriptor = to_property_descriptor(global_object, descriptor_object);
|
||||
if (auto* exception = vm.exception())
|
||||
return throw_completion(exception->value());
|
||||
auto descriptor = TRY(to_property_descriptor(global_object, descriptor_object));
|
||||
|
||||
// iii. Append the pair (a two element List) consisting of nextKey and desc to the end of descriptors.
|
||||
descriptors.append({ property_name, descriptor });
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue