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

@ -67,9 +67,7 @@ Value StringConstructor::construct(FunctionObject& new_target)
primitive_string = vm.argument(0).to_primitive_string(global_object());
if (!primitive_string)
return {};
auto* prototype = get_prototype_from_constructor(global_object(), new_target, &GlobalObject::string_prototype);
if (vm.exception())
return {};
auto* prototype = TRY_OR_DISCARD(get_prototype_from_constructor(global_object(), new_target, &GlobalObject::string_prototype));
return StringObject::create(global_object(), *primitive_string, *prototype);
}