Update String.fromCodePoint info to align with latest ECMAScript spec

This commit is contained in:
yossydev 2025-02-12 23:42:49 +09:00 committed by Philip Chimento
parent b0319e488d
commit c23db8061d
7 changed files with 40 additions and 63 deletions

View File

@ -7,14 +7,12 @@ description: >
info: | info: |
String.fromCodePoint ( ...codePoints ) String.fromCodePoint ( ...codePoints )
1. Let codePoints be a List containing the arguments passed to this function. 1. Let result be the empty String.
2. Let length be the number of elements in codePoints. 2. For each element next of codePoints, do
3. Let elements be a new List. a. Let nextCP be ? ToNumber(next).
4. Let nextIndex be 0. b. If nextCP is not an integral Number, throw a RangeError exception.
5. Repeat while nextIndex < length c. If (nextCP) < 0 or (nextCP) > 0x10FFFF, throw a RangeError exception.
a. Let next be codePoints[nextIndex]. ...
b. Let nextCP be ToNumber(next).
c. ReturnIfAbrupt(nextCP).
features: [Symbol, String.fromCodePoint] features: [Symbol, String.fromCodePoint]
---*/ ---*/

View File

@ -7,16 +7,10 @@ description: >
info: | info: |
String.fromCodePoint ( ...codePoints ) String.fromCodePoint ( ...codePoints )
1. Let codePoints be a List containing the arguments passed to this function. 1. Let result be the empty String.
2. Let length be the number of elements in codePoints. 2. For each element next of codePoints, do
3. Let elements be a new List. a. Let nextCP be ? ToNumber(next).
4. Let nextIndex be 0. b. If nextCP is not an integral Number, throw a RangeError exception.
5. Repeat while nextIndex < length
a. Let next be codePoints[nextIndex].
b. Let nextCP be ToNumber(next).
c. ReturnIfAbrupt(nextCP).
d. If SameValue(nextCP, ToInteger(nextCP)) is false, throw a RangeError
exception.
... ...
features: [String.fromCodePoint] features: [String.fromCodePoint]
---*/ ---*/

View File

@ -7,14 +7,14 @@ description: >
info: | info: |
String.fromCodePoint ( ...codePoints ) String.fromCodePoint ( ...codePoints )
1. Let codePoints be a List containing the arguments passed to this function. 1. Let result be the empty String.
2. Let length be the number of elements in codePoints. 2. For each element next of codePoints, do
3. Let elements be a new List. a. Let nextCP be ? ToNumber(next).
4. Let nextIndex be 0. b. If nextCP is not an integral Number, throw a RangeError exception.
5. Repeat while nextIndex < length c. If (nextCP) < 0 or (nextCP) > 0x10FFFF, throw a RangeError exception.
a. Let next be codePoints[nextIndex]. d. Set result to the string-concatenation of result and UTF16EncodeCodePoint((nextCP)).
b. Let nextCP be ToNumber(next). 3. Assert: If codePoints is empty, then result is the empty String.
c. ReturnIfAbrupt(nextCP). 4. Return result.
features: [String.fromCodePoint] features: [String.fromCodePoint]
---*/ ---*/

View File

@ -7,16 +7,11 @@ description: >
info: | info: |
String.fromCodePoint ( ...codePoints ) String.fromCodePoint ( ...codePoints )
1. Let codePoints be a List containing the arguments passed to this function. 1. Let result be the empty String.
... 2. For each element next of codePoints, do
5. Repeat while nextIndex < length
... ...
f. Append the elements of the UTF16Encoding (10.1.1) of nextCP to the end of 3. Assert: If codePoints is empty, then result is the empty String.
elements. 4. Return result.
g. Let nextIndex be nextIndex + 1.
6. Return the String value whose elements are, in order, the elements in the
List elements. If length is 0, the empty string is returned.
features: [String.fromCodePoint] features: [String.fromCodePoint]
---*/ ---*/

View File

@ -7,17 +7,11 @@ description: >
info: | info: |
String.fromCodePoint ( ...codePoints ) String.fromCodePoint ( ...codePoints )
1. Let codePoints be a List containing the arguments passed to this function. 1. Let result be the empty String.
2. Let length be the number of elements in codePoints. 2. For each element next of codePoints, do
3. Let elements be a new List. a. Let nextCP be ? ToNumber(next).
4. Let nextIndex be 0. b. If nextCP is not an integral Number, throw a RangeError exception.
5. Repeat while nextIndex < length c. If (nextCP) < 0 or (nextCP) > 0x10FFFF, throw a RangeError exception.
a. Let next be codePoints[nextIndex].
b. Let nextCP be ToNumber(next).
c. ReturnIfAbrupt(nextCP).
d. If SameValue(nextCP, ToInteger(nextCP)) is false, throw a RangeError
exception.
e. If nextCP < 0 or nextCP > 0x10FFFF, throw a RangeError exception.
... ...
features: [String.fromCodePoint] features: [String.fromCodePoint]
---*/ ---*/

View File

@ -8,15 +8,11 @@ description: >
info: | info: |
String.fromCodePoint ( ...codePoints ) String.fromCodePoint ( ...codePoints )
1. Let codePoints be a List containing the arguments passed to this function. 1. Let result be the empty String.
... 2. For each element next of codePoints, do
5. Repeat while nextIndex < length
... ...
f. Append the elements of the UTF16Encoding (10.1.1) of nextCP to the end of 3. Assert: If codePoints is empty, then result is the empty String.
elements. 4. Return result.
g. Let nextIndex be nextIndex + 1.
6. Return the String value whose elements are, in order, the elements in the
List elements. If length is 0, the empty string is returned.
features: [String.fromCodePoint] features: [String.fromCodePoint]
---*/ ---*/

View File

@ -7,14 +7,14 @@ description: >
info: | info: |
String.fromCodePoint ( ...codePoints ) String.fromCodePoint ( ...codePoints )
1. Let codePoints be a List containing the arguments passed to this function. 1. Let result be the empty String.
... 2. For each element next of codePoints, do
5. Repeat while nextIndex < length a. Let nextCP be ? ToNumber(next).
a. Let next be codePoints[nextIndex]. b. If nextCP is not an integral Number, throw a RangeError exception.
b. Let nextCP be ToNumber(next). c. If (nextCP) < 0 or (nextCP) > 0x10FFFF, throw a RangeError exception.
... d. Set result to the string-concatenation of result and UTF16EncodeCodePoint((nextCP)).
6. Return the String value whose elements are, in order, the elements in the 3. Assert: If codePoints is empty, then result is the empty String.
List elements. If length is 0, the empty string is returned. 4. Return result.
Ref: 7.1.3 ToNumber ( argument ) Ref: 7.1.3 ToNumber ( argument )
features: [String.fromCodePoint] features: [String.fromCodePoint]