From b48fa8756f9beaea7d1772ac3feafa98e1dd06e7 Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Tue, 13 Dec 2022 20:49:50 +0000 Subject: [PATCH] LibJS: Convert BooleanObject::create() to NonnullGCPtr --- Userland/Libraries/LibJS/Runtime/BooleanObject.cpp | 4 ++-- Userland/Libraries/LibJS/Runtime/BooleanObject.h | 2 +- Userland/Libraries/LibJS/Runtime/Value.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Userland/Libraries/LibJS/Runtime/BooleanObject.cpp b/Userland/Libraries/LibJS/Runtime/BooleanObject.cpp index fff4d481f5..ec8b9a16d9 100644 --- a/Userland/Libraries/LibJS/Runtime/BooleanObject.cpp +++ b/Userland/Libraries/LibJS/Runtime/BooleanObject.cpp @@ -9,9 +9,9 @@ namespace JS { -BooleanObject* BooleanObject::create(Realm& realm, bool value) +NonnullGCPtr BooleanObject::create(Realm& realm, bool value) { - return realm.heap().allocate(realm, value, *realm.intrinsics().boolean_prototype()); + return *realm.heap().allocate(realm, value, *realm.intrinsics().boolean_prototype()); } BooleanObject::BooleanObject(bool value, Object& prototype) diff --git a/Userland/Libraries/LibJS/Runtime/BooleanObject.h b/Userland/Libraries/LibJS/Runtime/BooleanObject.h index 308e3e8dac..9fddd976f2 100644 --- a/Userland/Libraries/LibJS/Runtime/BooleanObject.h +++ b/Userland/Libraries/LibJS/Runtime/BooleanObject.h @@ -14,7 +14,7 @@ class BooleanObject : public Object { JS_OBJECT(BooleanObject, Object); public: - static BooleanObject* create(Realm&, bool); + static NonnullGCPtr create(Realm&, bool); virtual ~BooleanObject() override = default; diff --git a/Userland/Libraries/LibJS/Runtime/Value.cpp b/Userland/Libraries/LibJS/Runtime/Value.cpp index 810520f1db..d891aa301e 100644 --- a/Userland/Libraries/LibJS/Runtime/Value.cpp +++ b/Userland/Libraries/LibJS/Runtime/Value.cpp @@ -536,7 +536,7 @@ ThrowCompletionOr 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.