LibJS: Convert BooleanObject::create() to NonnullGCPtr

This commit is contained in:
Linus Groh 2022-12-13 20:49:50 +00:00
parent cf0a24ff0c
commit b48fa8756f
Notes: sideshowbarker 2024-07-17 03:18:30 +09:00
3 changed files with 4 additions and 4 deletions

View file

@ -9,9 +9,9 @@
namespace JS {
BooleanObject* BooleanObject::create(Realm& realm, bool value)
NonnullGCPtr<BooleanObject> BooleanObject::create(Realm& realm, bool value)
{
return realm.heap().allocate<BooleanObject>(realm, value, *realm.intrinsics().boolean_prototype());
return *realm.heap().allocate<BooleanObject>(realm, value, *realm.intrinsics().boolean_prototype());
}
BooleanObject::BooleanObject(bool value, Object& prototype)

View file

@ -14,7 +14,7 @@ class BooleanObject : public Object {
JS_OBJECT(BooleanObject, Object);
public:
static BooleanObject* create(Realm&, bool);
static NonnullGCPtr<BooleanObject> create(Realm&, bool);
virtual ~BooleanObject() override = default;

View file

@ -536,7 +536,7 @@ ThrowCompletionOr<Object*> Value::to_object(VM& vm) const
// Boolean
case BOOLEAN_TAG:
// Return a new Boolean object whose [[BooleanData]] internal slot is set to argument. See 20.3 for a description of Boolean objects.
return BooleanObject::create(realm, as_bool());
return BooleanObject::create(realm, as_bool()).ptr();
// String
case STRING_TAG:
// Return a new String object whose [[StringData]] internal slot is set to argument. See 22.1 for a description of String objects.