1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 06:57:44 +00:00

LibJS: Convert Value::invoke and VM::call to ThrowCompletionOr

This commit is contained in:
Idan Horowitz 2021-09-23 20:56:28 +03:00
parent a90107b02a
commit ab594e5f2f
35 changed files with 196 additions and 328 deletions

View file

@ -703,7 +703,7 @@ Value Object::internal_get(PropertyName const& property_name, Value receiver) co
return js_undefined();
// 8. Return ? Call(getter, Receiver).
return vm.call(*getter, receiver);
return TRY_OR_DISCARD(vm.call(*getter, receiver));
}
static bool ordinary_set_with_own_descriptor(Object&, PropertyName const&, Value, Value, Optional<PropertyDescriptor>);
@ -1199,7 +1199,7 @@ Value Object::ordinary_to_primitive(Value::PreferredType preferred_type) const
if (vm.exception())
return {};
if (method.is_function()) {
auto result = vm.call(method.as_function(), const_cast<Object*>(this));
auto result = TRY_OR_DISCARD(vm.call(method.as_function(), const_cast<Object*>(this)));
if (!result.is_object())
return result;
}