From 34d463366c0ebeea7d6f2afb06f90a366342fdd8 Mon Sep 17 00:00:00 2001 From: Richard Gibson Date: Wed, 22 Sep 2021 14:39:59 -0700 Subject: [PATCH 1/3] Editorial: Clarify ToIndex (#2501) --- spec.html | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/spec.html b/spec.html index 3191db9794..4000499b4d 100644 --- a/spec.html +++ b/spec.html @@ -5618,22 +5618,22 @@

ToIndex ( - _value_: unknown, + _value_: an ECMAScript language value, )

description
-
It returns _value_ argument converted to a non-negative integer if it is a valid integer index value.
+
It converts _value_ to a non-negative integer if the corresponding decimal representation, as a String, is an integer index.
1. If _value_ is *undefined*, then 1. Return 0. 1. Else, - 1. Let _integerIndex_ be 𝔽(? ToIntegerOrInfinity(_value_)). - 1. If _integerIndex_ < *+0*𝔽, throw a *RangeError* exception. - 1. Let _index_ be ! ToLength(_integerIndex_). - 1. If ! SameValue(_integerIndex_, _index_) is *false*, throw a *RangeError* exception. - 1. Return ℝ(_index_). + 1. Let _integer_ be ? ToIntegerOrInfinity(_value_). + 1. Let _clamped_ be ! ToLength(𝔽(_integer_)). + 1. If ! SameValue(𝔽(_integer_), _clamped_) is *false*, throw a *RangeError* exception. + 1. Assert: 0 ≤ _integer_ ≤ 253 - 1. + 1. Return _integer_.
From a9221a0b0970edd4b05a0f29044c7fb4aa6e3a48 Mon Sep 17 00:00:00 2001 From: Richard Gibson Date: Wed, 22 Sep 2021 14:40:08 -0700 Subject: [PATCH 2/3] Editorial: Clarify ToLength (#2501) --- spec.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec.html b/spec.html index 4000499b4d..ab0a1e270f 100644 --- a/spec.html +++ b/spec.html @@ -5582,12 +5582,12 @@

ToLength ( - _argument_: unknown, + _argument_: an ECMAScript language value, )

description
-
It converts _argument_ to an integral Number suitable for use as the length of an array-like object.
+
It clamps _argument_ to an integral Number suitable for use as the length of an array-like object.
1. Let _len_ be ? ToIntegerOrInfinity(_argument_). From 1822f3701426254277e89b4170d01f1bb221b7c6 Mon Sep 17 00:00:00 2001 From: Richard Gibson Date: Wed, 22 Sep 2021 14:40:10 -0700 Subject: [PATCH 3/3] Editorial: Clarify ToIntegerOrInfinity (#2501) --- spec.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec.html b/spec.html index ab0a1e270f..0d3aa34edd 100644 --- a/spec.html +++ b/spec.html @@ -5037,12 +5037,12 @@

ToIntegerOrInfinity ( - _argument_: unknown, + _argument_: an ECMAScript language value, )

description
-
It converts _argument_ to an integer, +∞, or -∞.
+
It converts _argument_ to an integer representing its Number value with fractional part truncated, or to +∞ or -∞ when that Number value is infinite.
1. Let _number_ be ? ToNumber(_argument_).