summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2022-12-13 20:49:50 +0000
committerLinus Groh <mail@linusgroh.de>2022-12-14 09:59:45 +0000
commitcf0a24ff0c8be1710642aa163726b3edc11b2102 (patch)
tree004510dda1d04c0203b36f67ee4934942ff2101a
parent6528cbf51be4066fc4b7ca3bb41ab4a757a39064 (diff)
downloadserenity-cf0a24ff0c8be1710642aa163726b3edc11b2102.zip
LibJS: Convert BigIntObject::create() to NonnullGCPtr
-rw-r--r--Userland/Libraries/LibJS/Runtime/BigIntObject.cpp4
-rw-r--r--Userland/Libraries/LibJS/Runtime/BigIntObject.h4
-rw-r--r--Userland/Libraries/LibJS/Runtime/Value.cpp2
3 files changed, 5 insertions, 5 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/BigIntObject.cpp b/Userland/Libraries/LibJS/Runtime/BigIntObject.cpp
index ce05f94968..fcba8c987f 100644
--- a/Userland/Libraries/LibJS/Runtime/BigIntObject.cpp
+++ b/Userland/Libraries/LibJS/Runtime/BigIntObject.cpp
@@ -9,9 +9,9 @@
namespace JS {
-BigIntObject* BigIntObject::create(Realm& realm, BigInt& bigint)
+NonnullGCPtr<BigIntObject> BigIntObject::create(Realm& realm, BigInt& bigint)
{
- return realm.heap().allocate<BigIntObject>(realm, bigint, *realm.intrinsics().bigint_prototype());
+ return *realm.heap().allocate<BigIntObject>(realm, bigint, *realm.intrinsics().bigint_prototype());
}
BigIntObject::BigIntObject(BigInt& bigint, Object& prototype)
diff --git a/Userland/Libraries/LibJS/Runtime/BigIntObject.h b/Userland/Libraries/LibJS/Runtime/BigIntObject.h
index e8fcf6268e..df7140c14d 100644
--- a/Userland/Libraries/LibJS/Runtime/BigIntObject.h
+++ b/Userland/Libraries/LibJS/Runtime/BigIntObject.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020, Linus Groh <linusg@serenityos.org>
+ * Copyright (c) 2020-2022, Linus Groh <linusg@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@@ -15,7 +15,7 @@ class BigIntObject final : public Object {
JS_OBJECT(BigIntObject, Object);
public:
- static BigIntObject* create(Realm&, BigInt&);
+ static NonnullGCPtr<BigIntObject> create(Realm&, BigInt&);
virtual ~BigIntObject() override = default;
diff --git a/Userland/Libraries/LibJS/Runtime/Value.cpp b/Userland/Libraries/LibJS/Runtime/Value.cpp
index 3473dd8233..810520f1db 100644
--- a/Userland/Libraries/LibJS/Runtime/Value.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Value.cpp
@@ -548,7 +548,7 @@ ThrowCompletionOr<Object*> Value::to_object(VM& vm) const
// BigInt
case BIGINT_TAG:
// Return a new BigInt object whose [[BigIntData]] internal slot is set to argument. See 21.2 for a description of BigInt objects.
- return BigIntObject::create(realm, const_cast<JS::BigInt&>(as_bigint()));
+ return BigIntObject::create(realm, const_cast<JS::BigInt&>(as_bigint())).ptr();
// Object
case OBJECT_TAG:
// Return argument.