diff options
author | davidot <davidot@serenityos.org> | 2022-08-03 21:33:02 +0200 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-08-03 20:59:59 +0100 |
commit | 301bba8c19f6b05ccbd1296e4420e914ac470986 (patch) | |
tree | d733df956c93e06f7cbf82301b213a2f94739a9a /Userland/Libraries/LibJS/Runtime | |
parent | 8c11786145446c8cc1ecf86d0eb9428a2b43f0f6 (diff) | |
download | serenity-301bba8c19f6b05ccbd1296e4420e914ac470986.zip |
LibJS: Only coerce value once in BigInt constructor
See https://github.com/tc39/ecma262/pull/2812.
Diffstat (limited to 'Userland/Libraries/LibJS/Runtime')
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/BigIntConstructor.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/BigIntConstructor.cpp b/Userland/Libraries/LibJS/Runtime/BigIntConstructor.cpp index 739d40d313..98eae0460e 100644 --- a/Userland/Libraries/LibJS/Runtime/BigIntConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/BigIntConstructor.cpp @@ -52,8 +52,8 @@ ThrowCompletionOr<Value> BigIntConstructor::call() if (primitive.is_number()) return TRY(number_to_bigint(global_object, primitive)); - // 4. Otherwise, return ? ToBigInt(value). - return TRY(value.to_bigint(global_object)); + // 4. Otherwise, return ? ToBigInt(prim). + return TRY(primitive.to_bigint(global_object)); } // 21.2.1.1 BigInt ( value ), https://tc39.es/ecma262/#sec-bigint-constructor-number-value |