diff options
author | Linus Groh <mail@linusgroh.de> | 2022-08-21 14:00:56 +0100 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-08-23 13:58:30 +0100 |
commit | a022e548b808df91c471cb55f0245e15957e89c4 (patch) | |
tree | d6a7d452eae1d06e537a2fd77348ecaab278614f /Userland/Libraries/LibJS/Runtime/BigIntConstructor.cpp | |
parent | f6c4a0f5d00a6a03a5165f1618516acb320f13a4 (diff) | |
download | serenity-a022e548b808df91c471cb55f0245e15957e89c4.zip |
LibJS: Replace GlobalObject with VM in Value AOs [Part 4/19]
This is where the fun begins. :^)
Diffstat (limited to 'Userland/Libraries/LibJS/Runtime/BigIntConstructor.cpp')
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/BigIntConstructor.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/BigIntConstructor.cpp b/Userland/Libraries/LibJS/Runtime/BigIntConstructor.cpp index e4747fed36..1f581fc4eb 100644 --- a/Userland/Libraries/LibJS/Runtime/BigIntConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/BigIntConstructor.cpp @@ -46,14 +46,14 @@ ThrowCompletionOr<Value> BigIntConstructor::call() auto value = vm.argument(0); // 2. Let prim be ? ToPrimitive(value, number). - auto primitive = TRY(value.to_primitive(global_object, Value::PreferredType::Number)); + auto primitive = TRY(value.to_primitive(vm, Value::PreferredType::Number)); // 3. If Type(prim) is Number, return ? NumberToBigInt(prim). if (primitive.is_number()) return TRY(number_to_bigint(global_object, primitive)); // 4. Otherwise, return ? ToBigInt(prim). - return TRY(primitive.to_bigint(global_object)); + return TRY(primitive.to_bigint(vm)); } // 21.2.1.1 BigInt ( value ), https://tc39.es/ecma262/#sec-bigint-constructor-number-value @@ -66,10 +66,10 @@ ThrowCompletionOr<Object*> BigIntConstructor::construct(FunctionObject&) JS_DEFINE_NATIVE_FUNCTION(BigIntConstructor::as_int_n) { // 1. Set bits to ? ToIndex(bits). - auto bits = TRY(vm.argument(0).to_index(global_object)); + auto bits = TRY(vm.argument(0).to_index(vm)); // 2. Set bigint to ? ToBigInt(bigint). - auto* bigint = TRY(vm.argument(1).to_bigint(global_object)); + auto* bigint = TRY(vm.argument(1).to_bigint(vm)); // 3. Let mod be ℝ(bigint) modulo 2^bits. // FIXME: For large values of `bits`, this can likely be improved with a SignedBigInteger API to @@ -92,10 +92,10 @@ JS_DEFINE_NATIVE_FUNCTION(BigIntConstructor::as_int_n) JS_DEFINE_NATIVE_FUNCTION(BigIntConstructor::as_uint_n) { // 1. Set bits to ? ToIndex(bits). - auto bits = TRY(vm.argument(0).to_index(global_object)); + auto bits = TRY(vm.argument(0).to_index(vm)); // 2. Set bigint to ? ToBigInt(bigint). - auto* bigint = TRY(vm.argument(1).to_bigint(global_object)); + auto* bigint = TRY(vm.argument(1).to_bigint(vm)); // 3. Return the BigInt value that represents ℝ(bigint) modulo 2bits. // FIXME: For large values of `bits`, this can likely be improved with a SignedBigInteger API to |