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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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