From 9c6eba771ad4bf4bd6e26d0002a81ce4baba9a0c Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Sat, 15 Apr 2023 16:04:29 +0200 Subject: [PATCH] LibJS: Port this_bigint_value() to NonnullGCPtr --- Userland/Libraries/LibJS/Runtime/BigIntPrototype.cpp | 10 +++++----- 1 file 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 BigIntPrototype::initialize(Realm& realm) } // thisBigIntValue ( value ), https://tc39.es/ecma262/#thisbigintvalue -static ThrowCompletionOr this_bigint_value(VM& vm, Value value) +static ThrowCompletionOr> 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(value.as_object())) { // a. Assert: value.[[BigIntData]] is a BigInt. // b. Return value.[[BigIntData]]. - return &static_cast(value.as_object()).bigint(); + return static_cast(value.as_object()).bigint(); } // 3. Throw a TypeError exception. @@ -59,7 +59,7 @@ static ThrowCompletionOr 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(TRY(construct(vm, realm.intrinsics().intl_number_format_constructor(), locales, options)).ptr());