1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 07:47:37 +00:00

LibJS: Convert ordinary_create_from_constructor<T> to ThrowCompletionOr

This commit is contained in:
Idan Horowitz 2021-09-16 00:57:38 +03:00 committed by Linus Groh
parent b61eff8730
commit 5a4c90fcb1
30 changed files with 38 additions and 93 deletions

View file

@ -475,11 +475,8 @@ Value VM::construct(FunctionObject& function, FunctionObject& new_target, Option
auto& global_object = function.global_object();
Value this_argument;
if (function.constructor_kind() == FunctionObject::ConstructorKind::Base) {
this_argument = ordinary_create_from_constructor<Object>(global_object, new_target, &GlobalObject::object_prototype);
if (exception())
return {};
}
if (function.constructor_kind() == FunctionObject::ConstructorKind::Base)
this_argument = TRY_OR_DISCARD(ordinary_create_from_constructor<Object>(global_object, new_target, &GlobalObject::object_prototype));
// FIXME: prepare_for_ordinary_call() is not supposed to receive a BoundFunction, ProxyObject, etc. - ever.
// This needs to be moved to NativeFunction/OrdinaryFunctionObject's construct() (10.2.2 [[Construct]])