1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:18:11 +00:00

LibJS: Use ThrowCompletionOr in get_prototype_from_constructor()

Also add spec step comments to it while we're here.
This commit is contained in:
Linus Groh 2021-09-15 21:16:31 +01:00
parent bc1b8f9cc8
commit 2d4650714f
5 changed files with 21 additions and 19 deletions

View file

@ -55,9 +55,7 @@ Value ArrayConstructor::construct(FunctionObject& new_target)
{
auto& vm = this->vm();
auto* proto = get_prototype_from_constructor(global_object(), new_target, &GlobalObject::array_prototype);
if (vm.exception())
return {};
auto* proto = TRY_OR_DISCARD(get_prototype_from_constructor(global_object(), new_target, &GlobalObject::array_prototype));
if (vm.argument_count() == 0)
return Array::create(global_object(), 0, proto);