1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:07:45 +00:00

LibJS: Only coerce value once in BigInt constructor

See https://github.com/tc39/ecma262/pull/2812.
This commit is contained in:
davidot 2022-08-03 21:33:02 +02:00 committed by Linus Groh
parent 8c11786145
commit 301bba8c19
2 changed files with 16 additions and 2 deletions

View file

@ -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