1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 17:57:35 +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

@ -76,9 +76,10 @@ void FunctionObject::InstanceField::define_field(VM& vm, Object& receiver) const
{
Value init_value = js_undefined();
if (initializer) {
init_value = vm.call(*initializer, receiver.value_of());
if (vm.exception())
auto init_value_or_error = vm.call(*initializer, receiver.value_of());
if (init_value_or_error.is_error())
return;
init_value = init_value_or_error.release_value();
}
receiver.create_data_property_or_throw(name, init_value);
}