1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:48: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

@ -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);
}