Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement String.fromCharCode #1619

Merged
merged 1 commit into from
Oct 4, 2021

Conversation

hle0
Copy link
Contributor

@hle0 hle0 commented Oct 3, 2021

Signed-off-by: hle0 91701075+hle0@users.noreply.github.com

This pull request changes the following:

Signed-off-by: hle0 <91701075+hle0@users.noreply.github.com>
@jedel1043
Copy link
Member

Test262 conformance changes:

Test result master count PR count difference
Total 80,930 80,930 0
Passed 33,364 33,442 +78
Ignored 15,898 15,898 0
Failed 31,668 31,590 -78
Panics 0 0 0
Conformance 41.23% 41.32% +0.10%
Fixed tests (78):
test/language/literals/regexp/u-null-character-escape.js [strict mode] (previously Failed)
test/language/literals/regexp/u-null-character-escape.js (previously Failed)
test/language/literals/string/S7.8.4_A4.2_T5.js [strict mode] (previously Failed)
test/language/literals/string/S7.8.4_A4.2_T5.js (previously Failed)
test/language/literals/string/S7.8.4_A4.2_T3.js [strict mode] (previously Failed)
test/language/literals/string/S7.8.4_A4.2_T3.js (previously Failed)
test/language/literals/string/S7.8.4_A6.1_T1.js [strict mode] (previously Failed)
test/language/literals/string/S7.8.4_A6.1_T1.js (previously Failed)
test/language/literals/string/S7.8.4_A7.3_T1.js [strict mode] (previously Failed)
test/language/literals/string/S7.8.4_A7.3_T1.js (previously Failed)
test/language/literals/string/S7.8.4_A4.1_T2.js [strict mode] (previously Failed)
test/language/literals/string/S7.8.4_A4.1_T2.js (previously Failed)
test/language/literals/string/S7.8.4_A4.2_T7.js [strict mode] (previously Failed)
test/language/literals/string/S7.8.4_A4.2_T7.js (previously Failed)
test/language/literals/string/S7.8.4_A7.1_T1.js [strict mode] (previously Failed)
test/language/literals/string/S7.8.4_A7.1_T1.js (previously Failed)
test/language/literals/string/S7.8.4_A4.1_T1.js [strict mode] (previously Failed)
test/language/literals/string/S7.8.4_A4.1_T1.js (previously Failed)
test/language/literals/string/S7.8.4_A6.3_T1.js [strict mode] (previously Failed)
test/language/literals/string/S7.8.4_A6.3_T1.js (previously Failed)
test/language/literals/string/S7.8.4_A4.2_T1.js [strict mode] (previously Failed)
test/language/literals/string/S7.8.4_A4.2_T1.js (previously Failed)
test/language/literals/string/S7.8.4_A5.1_T1.js [strict mode] (previously Failed)
test/language/literals/string/S7.8.4_A5.1_T1.js (previously Failed)
test/language/expressions/property-accessors/S11.2.1_A4_T5.js [strict mode] (previously Failed)
test/language/expressions/property-accessors/S11.2.1_A4_T5.js (previously Failed)
test/built-ins/RegExp/S15.10.2.10_A2.1_T1.js [strict mode] (previously Failed)
test/built-ins/RegExp/S15.10.2.10_A2.1_T1.js (previously Failed)
test/built-ins/RegExp/character-class-escape-non-whitespace-u180e.js [strict mode] (previously Failed)
test/built-ins/RegExp/character-class-escape-non-whitespace-u180e.js (previously Failed)
test/built-ins/RegExp/unicode_restricted_identity_escape.js [strict mode] (previously Failed)
test/built-ins/RegExp/unicode_restricted_identity_escape.js (previously Failed)
test/built-ins/RegExp/unicode_restricted_identity_escape_c.js [strict mode] (previously Failed)
test/built-ins/RegExp/unicode_restricted_identity_escape_c.js (previously Failed)
test/built-ins/RegExp/S15.10.2.10_A2.1_T2.js [strict mode] (previously Failed)
test/built-ins/RegExp/S15.10.2.10_A2.1_T2.js (previously Failed)
test/built-ins/String/fromCharCode/S15.5.3.2_A3_T1.js [strict mode] (previously Failed)
test/built-ins/String/fromCharCode/S15.5.3.2_A3_T1.js (previously Failed)
test/built-ins/String/fromCharCode/name.js [strict mode] (previously Failed)
test/built-ins/String/fromCharCode/name.js (previously Failed)
test/built-ins/String/fromCharCode/S15.5.3.2_A3_T2.js [strict mode] (previously Failed)
test/built-ins/String/fromCharCode/S15.5.3.2_A3_T2.js (previously Failed)
test/built-ins/String/fromCharCode/S9.7_A3.1_T4.js [strict mode] (previously Failed)
test/built-ins/String/fromCharCode/S9.7_A3.1_T4.js (previously Failed)
test/built-ins/String/fromCharCode/S15.5.3.2_A2.js [strict mode] (previously Failed)
test/built-ins/String/fromCharCode/S15.5.3.2_A2.js (previously Failed)
test/built-ins/String/fromCharCode/S9.7_A3.2_T1.js [strict mode] (previously Failed)
test/built-ins/String/fromCharCode/S9.7_A3.2_T1.js (previously Failed)
test/built-ins/String/fromCharCode/S9.7_A2.1.js [strict mode] (previously Failed)
test/built-ins/String/fromCharCode/S9.7_A2.1.js (previously Failed)
test/built-ins/String/fromCharCode/S9.7_A2.2.js [strict mode] (previously Failed)
test/built-ins/String/fromCharCode/S9.7_A2.2.js (previously Failed)
test/built-ins/String/fromCharCode/S9.7_A1.js [strict mode] (previously Failed)
test/built-ins/String/fromCharCode/S9.7_A1.js (previously Failed)
test/built-ins/String/fromCharCode/S9.7_A3.1_T1.js [strict mode] (previously Failed)
test/built-ins/String/fromCharCode/S9.7_A3.1_T1.js (previously Failed)
test/built-ins/String/fromCharCode/S9.7_A3.1_T3.js [strict mode] (previously Failed)
test/built-ins/String/fromCharCode/S9.7_A3.1_T3.js (previously Failed)
test/built-ins/String/fromCharCode/S15.5.3.2_A1.js [strict mode] (previously Failed)
test/built-ins/String/fromCharCode/S15.5.3.2_A1.js (previously Failed)
test/built-ins/String/fromCharCode/S9.7_A3.1_T2.js [strict mode] (previously Failed)
test/built-ins/String/fromCharCode/S9.7_A3.1_T2.js (previously Failed)
test/built-ins/String/prototype/indexOf/S15.5.4.7_A5_T1.js [strict mode] (previously Failed)
test/built-ins/String/prototype/indexOf/S15.5.4.7_A5_T1.js (previously Failed)
test/built-ins/String/prototype/indexOf/S15.5.4.7_A5_T2.js [strict mode] (previously Failed)
test/built-ins/String/prototype/indexOf/S15.5.4.7_A5_T2.js (previously Failed)
test/built-ins/String/prototype/indexOf/S15.5.4.7_A5_T5.js [strict mode] (previously Failed)
test/built-ins/String/prototype/indexOf/S15.5.4.7_A5_T5.js (previously Failed)
test/built-ins/String/prototype/indexOf/S15.5.4.7_A5_T4.js [strict mode] (previously Failed)
test/built-ins/String/prototype/indexOf/S15.5.4.7_A5_T4.js (previously Failed)
test/built-ins/Number/prototype/toString/a-z.js [strict mode] (previously Failed)
test/built-ins/Number/prototype/toString/a-z.js (previously Failed)
test/built-ins/Object/getOwnPropertyDescriptor/15.2.3.3-4-61.js [strict mode] (previously Failed)
test/built-ins/Object/getOwnPropertyDescriptor/15.2.3.3-4-61.js (previously Failed)
test/built-ins/parseFloat/S15.1.2.3_A6.js [strict mode] (previously Failed)
test/built-ins/parseFloat/S15.1.2.3_A6.js (previously Failed)
test/built-ins/parseInt/S15.1.2.2_A8.js [strict mode] (previously Failed)
test/built-ins/parseInt/S15.1.2.2_A8.js (previously Failed)

Comment on lines +258 to +264
let mut elements = Vec::new();
// 3. For each element next of codeUnits, do
for next in args {
// 3a. Let nextCU be ℝ(? ToUint16(next)).
// 3b. Append nextCU to the end of elements.
elements.push(next.to_u32(context)? as u16);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just noting that, when #1552 gets merged, this should be simplified further to:

args.iter()
    .map(|val| val.to_u16(context))
    .collect::<JsResult<Vec<_>>>()?;

Copy link
Member

@jedel1043 jedel1043 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@jedel1043 jedel1043 merged commit 9f6245c into boa-dev:master Oct 4, 2021
@raskad raskad added this to the v0.14.0 milestone Oct 4, 2021
@jedel1043 jedel1043 added builtins PRs and Issues related to builtins/intrinsics enhancement New feature or request Hacktoberfest Hacktoberfest 2021 - https://hacktoberfest.digitalocean.com labels Oct 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
builtins PRs and Issues related to builtins/intrinsics enhancement New feature or request Hacktoberfest Hacktoberfest 2021 - https://hacktoberfest.digitalocean.com
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants