summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2023-04-15 16:04:29 +0200
committerLinus Groh <mail@linusgroh.de>2023-04-15 16:06:02 +0200
commit9c6eba771ad4bf4bd6e26d0002a81ce4baba9a0c (patch)
tree2571b7b1e2f6bbed2b42420067282388ec6ae6f4
parentd8ee4c0e7d6f3dcccee19bf61b102043e98085f9 (diff)
downloadserenity-9c6eba771ad4bf4bd6e26d0002a81ce4baba9a0c.zip
LibJS: Port this_bigint_value() to NonnullGCPtr
-rw-r--r--Userland/Libraries/LibJS/Runtime/BigIntPrototype.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/BigIntPrototype.cpp b/Userland/Libraries/LibJS/Runtime/BigIntPrototype.cpp
index db46d2a497..f629b3eb84 100644
--- a/Userland/Libraries/LibJS/Runtime/BigIntPrototype.cpp
+++ b/Userland/Libraries/LibJS/Runtime/BigIntPrototype.cpp
@@ -38,17 +38,17 @@ ThrowCompletionOr<void> BigIntPrototype::initialize(Realm& realm)
}
// thisBigIntValue ( value ), https://tc39.es/ecma262/#thisbigintvalue
-static ThrowCompletionOr<BigInt*> this_bigint_value(VM& vm, Value value)
+static ThrowCompletionOr<NonnullGCPtr<BigInt>> this_bigint_value(VM& vm, Value value)
{
// 1. If value is a BigInt, return value.
if (value.is_bigint())
- return &value.as_bigint();
+ return value.as_bigint();
// 2. If value is an Object and value has a [[BigIntData]] internal slot, then
if (value.is_object() && is<BigIntObject>(value.as_object())) {
// a. Assert: value.[[BigIntData]] is a BigInt.
// b. Return value.[[BigIntData]].
- return &static_cast<BigIntObject&>(value.as_object()).bigint();
+ return static_cast<BigIntObject&>(value.as_object()).bigint();
}
// 3. Throw a TypeError exception.
@@ -59,7 +59,7 @@ static ThrowCompletionOr<BigInt*> this_bigint_value(VM& vm, Value value)
JS_DEFINE_NATIVE_FUNCTION(BigIntPrototype::to_string)
{
// 1. Let x be ? thisBigIntValue(this value).
- auto* bigint = TRY(this_bigint_value(vm, vm.this_value()));
+ auto bigint = TRY(this_bigint_value(vm, vm.this_value()));
// 2. If radix is undefined, let radixMV be 10.
double radix = 10;
@@ -87,7 +87,7 @@ JS_DEFINE_NATIVE_FUNCTION(BigIntPrototype::to_locale_string)
auto options = vm.argument(1);
// 1. Let x be ? thisBigIntValue(this value).
- auto* bigint = TRY(this_bigint_value(vm, vm.this_value()));
+ auto bigint = TRY(this_bigint_value(vm, vm.this_value()));
// 2. Let numberFormat be ? Construct(%NumberFormat%, ยซ locales, options ยป).
auto* number_format = static_cast<Intl::NumberFormat*>(TRY(construct(vm, realm.intrinsics().intl_number_format_constructor(), locales, options)).ptr());