From 46639e8656ea2d65a3e2acf6c78b6020768ae55a Mon Sep 17 00:00:00 2001 From: Dominic Farolino Date: Tue, 11 Jul 2023 20:08:59 -0400 Subject: [PATCH] Handle BigInt with the `%d` and `%i` format specifiers --- index.bs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/index.bs b/index.bs index db579fb..30c27ef 100644 --- a/index.bs +++ b/index.bs @@ -17,6 +17,8 @@ urlPrefix: https://tc39.github.io/ecma262/#; spec: ECMASCRIPT text: Type; url: sec-ecmascript-data-types-and-values text: ToString; url: sec-tostring text: Call; url: sec-call + for: BigInt + text: toString; url: sec-numeric-types-bigint-tostring type: interface text: %ObjectPrototype%; url: sec-properties-of-the-object-prototype-object type: constructor @@ -315,11 +317,13 @@ more arguments are left. It returns a [=/list=] of objects suitable for printing 1. If |specifier| is `%s`, let |converted| be the result of [$Call$](%String%, **undefined**, « |current| »). 1. If |specifier| is `%d` or `%i`: - 1. If [$Type$](|current|) is Symbol, let |converted| be `NaN` + 1. If [$Type$](|current|) is Symbol, let |converted| be `NaN`. + 1. Otherwise, if [$Type$](|current|) is BigInt, let |converted| be + [$BigInt/toString|BigInt::toString$](|current|, 10). 1. Otherwise, let |converted| be the result of [$Call$]([=%parseInt%=], **undefined**, « |current|, 10 »). 1. If |specifier| is `%f`: - 1. If [$Type$](|current|) is Symbol, let |converted| be `NaN` + 1. If [$Type$](|current|) is Symbol, let |converted| be `NaN`. 1. Otherwise, let |converted| be the result of [$Call$]([=%parseFloat%=], **undefined**, « |current| »). 1. If |specifier| is `%o`, optionally let |converted| be |current| with