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

LibJS: Convert internal_set_prototype_of() to ThrowCompletionOr

This commit is contained in:
Linus Groh 2021-09-28 23:54:42 +01:00
parent 5148150e1c
commit 8c81c84c18
20 changed files with 43 additions and 50 deletions

View file

@ -48,7 +48,8 @@ Object::Object(ConstructWithoutPrototypeTag, GlobalObject& global_object)
Object::Object(Object& prototype)
{
m_shape = prototype.global_object().empty_object_shape();
auto success = internal_set_prototype_of(&prototype);
// FIXME: Factor out step 9 into a simple prototype setter and use that
auto success = internal_set_prototype_of(&prototype).release_value();
VERIFY(success);
}
@ -496,7 +497,7 @@ ThrowCompletionOr<Object*> Object::internal_get_prototype_of() const
}
// 10.1.2 [[SetPrototypeOf]] ( V ), https://tc39.es/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots-setprototypeof-v
bool Object::internal_set_prototype_of(Object* new_prototype)
ThrowCompletionOr<bool> Object::internal_set_prototype_of(Object* new_prototype)
{
// 1. Assert: Either Type(V) is Object or Type(V) is Null.