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
commit 2d4650714f
Notes: sideshowbarker 2024-07-18 03:54:19 +09:00
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);