mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
LibJS: Convert BigIntObject::create() to NonnullGCPtr
This commit is contained in:
parent
6528cbf51b
commit
cf0a24ff0c
Notes:
sideshowbarker
2024-07-17 03:18:33 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/cf0a24ff0c Pull-request: https://github.com/SerenityOS/serenity/pull/16479 Reviewed-by: https://github.com/davidot ✅
3 changed files with 5 additions and 5 deletions
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in a new issue