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

[Merged by Bors] - Implement prototype of Intl built-in #1622

Closed
wants to merge 11 commits into from

Conversation

hle0
Copy link
Contributor

@hle0 hle0 commented Oct 3, 2021

This pull request is related to #1180.

It changes the following:

  • Creates the Intl global
  • Adds the Intl.getCanonicalLocales method

At the moment it does not actually use ICU4X behind the scenes; Intl.getCanonicalLocales simply acts as if all the locales passed are canonical locales. This will not be the case in the final PR.

hle0 added 2 commits October 3, 2021 20:46
Signed-off-by: hle0 <91701075+hle0@users.noreply.github.com>
Signed-off-by: hle0 <91701075+hle0@users.noreply.github.com>
Co-authored-by: jedel1043 <jedel0124@gmail.com>
@jedel1043
Copy link
Member

Ah, you have to use super::JsArgs; to import get_or_undefined

hle0 added 4 commits October 4, 2021 00:56
Signed-off-by: hle0 <91701075+hle0@users.noreply.github.com>
Signed-off-by: hle0 <91701075+hle0@users.noreply.github.com>
Signed-off-by: hle0 <91701075+hle0@users.noreply.github.com>
Signed-off-by: hle0 <91701075+hle0@users.noreply.github.com>
@raskad
Copy link
Member

raskad commented Oct 4, 2021

Test262 conformance changes:

Test result master count PR count difference
Total 80,930 80,930 0
Passed 33,364 33,438 +74
Ignored 15,898 15,898 0
Failed 31,668 31,594 -74
Panics 0 0 0
Conformance 41.23% 41.32% +0.09%
Fixed tests (74):
test/intl402/constructors-string-and-single-element-array.js [strict mode] (previously Failed)
test/intl402/constructors-string-and-single-element-array.js (previously Failed)
test/intl402/supportedLocalesOf-throws-if-element-not-string-or-object.js [strict mode] (previously Failed)
test/intl402/supportedLocalesOf-throws-if-element-not-string-or-object.js (previously Failed)
test/intl402/NumberFormat/this-value-ignored.js [strict mode] (previously Failed)
test/intl402/NumberFormat/this-value-ignored.js (previously Failed)
test/intl402/NumberFormat/prototype/this-value-numberformat-prototype.js [strict mode] (previously Failed)
test/intl402/NumberFormat/prototype/this-value-numberformat-prototype.js (previously Failed)
test/intl402/DisplayNames/options-null-throws.js [strict mode] (previously Failed)
test/intl402/DisplayNames/options-null-throws.js (previously Failed)
test/intl402/DisplayNames/undefined-newtarget-throws.js [strict mode] (previously Failed)
test/intl402/DisplayNames/undefined-newtarget-throws.js (previously Failed)
test/intl402/DisplayNames/locales-invalid-throws.js [strict mode] (previously Failed)
test/intl402/DisplayNames/locales-invalid-throws.js (previously Failed)
test/intl402/DisplayNames/options-getoptionsobject.js [strict mode] (previously Failed)
test/intl402/DisplayNames/options-getoptionsobject.js (previously Failed)
test/intl402/BigInt/prototype/toLocaleString/throws-same-exceptions-as-NumberFormat.js [strict mode] (previously Failed)
test/intl402/BigInt/prototype/toLocaleString/throws-same-exceptions-as-NumberFormat.js (previously Failed)
test/intl402/String/prototype/localeCompare/throws-same-exceptions-as-Collator.js [strict mode] (previously Failed)
test/intl402/String/prototype/localeCompare/throws-same-exceptions-as-Collator.js (previously Failed)
test/intl402/Number/prototype/toLocaleString/taint-Intl-NumberFormat.js [strict mode] (previously Failed)
test/intl402/Number/prototype/toLocaleString/taint-Intl-NumberFormat.js (previously Failed)
test/intl402/ListFormat/constructor/constructor/options-getoptionsobject.js [strict mode] (previously Failed)
test/intl402/ListFormat/constructor/constructor/options-getoptionsobject.js (previously Failed)
test/intl402/Collator/prototype/this-value-collator-prototype.js [strict mode] (previously Failed)
test/intl402/Collator/prototype/this-value-collator-prototype.js (previously Failed)
test/intl402/Intl/builtin.js [strict mode] (previously Failed)
test/intl402/Intl/builtin.js (previously Failed)
test/intl402/Intl/getCanonicalLocales/overriden-arg-length.js [strict mode] (previously Failed)
test/intl402/Intl/getCanonicalLocales/overriden-arg-length.js (previously Failed)
test/intl402/Intl/getCanonicalLocales/locales-is-not-a-string.js [strict mode] (previously Failed)
test/intl402/Intl/getCanonicalLocales/locales-is-not-a-string.js (previously Failed)
test/intl402/Intl/getCanonicalLocales/elements-not-reordered.js [strict mode] (previously Failed)
test/intl402/Intl/getCanonicalLocales/elements-not-reordered.js (previously Failed)
test/intl402/Intl/getCanonicalLocales/returned-object-is-an-array.js [strict mode] (previously Failed)
test/intl402/Intl/getCanonicalLocales/returned-object-is-an-array.js (previously Failed)
test/intl402/Intl/getCanonicalLocales/name.js [strict mode] (previously Failed)
test/intl402/Intl/getCanonicalLocales/name.js (previously Failed)
test/intl402/Intl/getCanonicalLocales/returned-object-is-mutable.js [strict mode] (previously Failed)
test/intl402/Intl/getCanonicalLocales/returned-object-is-mutable.js (previously Failed)
test/intl402/Intl/getCanonicalLocales/overriden-push.js [strict mode] (previously Failed)
test/intl402/Intl/getCanonicalLocales/overriden-push.js (previously Failed)
test/intl402/Intl/getCanonicalLocales/canonicalized-unicode-ext-seq.js [strict mode] (previously Failed)
test/intl402/Intl/getCanonicalLocales/canonicalized-unicode-ext-seq.js (previously Failed)
test/intl402/Intl/getCanonicalLocales/getCanonicalLocales.js [strict mode] (previously Failed)
test/intl402/Intl/getCanonicalLocales/getCanonicalLocales.js (previously Failed)
test/intl402/Intl/getCanonicalLocales/descriptor.js [strict mode] (previously Failed)
test/intl402/Intl/getCanonicalLocales/descriptor.js (previously Failed)
test/intl402/Intl/getCanonicalLocales/weird-cases.js [strict mode] (previously Failed)
test/intl402/Intl/getCanonicalLocales/weird-cases.js (previously Failed)
test/intl402/Intl/getCanonicalLocales/length.js [strict mode] (previously Failed)
test/intl402/Intl/getCanonicalLocales/length.js (previously Failed)
test/intl402/Intl/getCanonicalLocales/to-string.js [strict mode] (previously Failed)
test/intl402/Intl/getCanonicalLocales/to-string.js (previously Failed)
test/intl402/Intl/getCanonicalLocales/get-locale.js [strict mode] (previously Failed)
test/intl402/Intl/getCanonicalLocales/get-locale.js (previously Failed)
test/intl402/Intl/toStringTag/toStringTag.js [strict mode] (previously Failed)
test/intl402/Intl/toStringTag/toStringTag.js (previously Failed)
test/intl402/Intl/toStringTag/toString.js [strict mode] (previously Failed)
test/intl402/Intl/toStringTag/toString.js (previously Failed)
test/intl402/PluralRules/prototype/prototype.js [strict mode] (previously Failed)
test/intl402/PluralRules/prototype/prototype.js (previously Failed)
test/intl402/DateTimeFormat/this-value-ignored.js [strict mode] (previously Failed)
test/intl402/DateTimeFormat/this-value-ignored.js (previously Failed)
test/intl402/DateTimeFormat/constructor-options-style-conflict.js [strict mode] (previously Failed)
test/intl402/DateTimeFormat/constructor-options-style-conflict.js (previously Failed)
test/intl402/DateTimeFormat/prototype/this-value-datetimeformat-prototype.js [strict mode] (previously Failed)
test/intl402/DateTimeFormat/prototype/this-value-datetimeformat-prototype.js (previously Failed)
test/intl402/Segmenter/constructor/constructor/options-null.js [strict mode] (previously Failed)
test/intl402/Segmenter/constructor/constructor/options-null.js (previously Failed)
test/intl402/Segmenter/constructor/constructor/options-getoptionsobject.js [strict mode] (previously Failed)
test/intl402/Segmenter/constructor/constructor/options-getoptionsobject.js (previously Failed)
test/intl402/Date/prototype/throws-same-exceptions-as-DateTimeFormat.js [strict mode] (previously Failed)
test/intl402/Date/prototype/throws-same-exceptions-as-DateTimeFormat.js (previously Failed)

@hle0 hle0 marked this pull request as ready for review October 4, 2021 01:52
hle0 and others added 3 commits October 3, 2021 23:39
Co-authored-by: jedel1043 <jedel0124@gmail.com>
Co-authored-by: jedel1043 <jedel0124@gmail.com>
Signed-off-by: hle0 <91701075+hle0@users.noreply.github.com>
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.

Great work! This should be a pretty good starting point to begin integrating icu4x

@jedel1043 jedel1043 changed the title Add Intl global Implement prototype of Intl built-in Oct 7, 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 7, 2021
@jedel1043 jedel1043 added this to the v0.14.0 milestone Oct 7, 2021
Copy link
Member

@raskad raskad 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, just needs a rebase.

@codecov
Copy link

codecov bot commented Oct 24, 2021

Codecov Report

Merging #1622 (587bc20) into main (6262bd9) will increase coverage by 6.51%.
The diff coverage is 18.18%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1622      +/-   ##
==========================================
+ Coverage   44.40%   50.91%   +6.51%     
==========================================
  Files         203      199       -4     
  Lines       20270    17707    -2563     
==========================================
+ Hits         9000     9016      +16     
+ Misses      11270     8691    -2579     
Impacted Files Coverage Δ
boa/src/builtins/mod.rs 23.72% <0.00%> (-0.41%) ⬇️
boa/src/builtins/intl/mod.rs 18.75% <18.75%> (ø)
boa_cli/src/main.rs 5.88% <0.00%> (-27.46%) ⬇️
boa/src/lib.rs 77.55% <0.00%> (-15.14%) ⬇️
...tax/parser/expression/assignment/exponentiation.rs 64.00% <0.00%> (-13.78%) ⬇️
boa/src/syntax/lexer/string.rs 56.15% <0.00%> (-4.68%) ⬇️
boa/src/syntax/lexer/number.rs 64.73% <0.00%> (-1.54%) ⬇️
boa/src/object/internal_methods/array.rs 68.05% <0.00%> (-1.51%) ⬇️
...syntax/parser/statement/iteration/for_statement.rs 71.66% <0.00%> (-1.22%) ⬇️
boa/src/value/operations.rs 45.39% <0.00%> (-1.04%) ⬇️
... and 101 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6262bd9...587bc20. Read the comment docs.

@RageKnify
Copy link
Contributor

bors r+

bors bot pushed a commit that referenced this pull request Oct 24, 2021
<!---
Thank you for contributing to Boa! Please fill out the template below, and remove or add any
information as you feel neccesary.
--->

This pull request is related to #1180.

It changes the following:

- Creates the `Intl` global
- Adds the `Intl.getCanonicalLocales` method

At the moment it does not actually use ICU4X behind the scenes; `Intl.getCanonicalLocales` simply acts as if all the locales passed are canonical locales. This will not be the case in the final PR.


Co-authored-by: RageKnify <RageKnify@gmail.com>
@bors
Copy link

bors bot commented Oct 24, 2021

Build failed:

@RageKnify
Copy link
Contributor

bors retry

bors bot pushed a commit that referenced this pull request Oct 24, 2021
<!---
Thank you for contributing to Boa! Please fill out the template below, and remove or add any
information as you feel neccesary.
--->

This pull request is related to #1180.

It changes the following:

- Creates the `Intl` global
- Adds the `Intl.getCanonicalLocales` method

At the moment it does not actually use ICU4X behind the scenes; `Intl.getCanonicalLocales` simply acts as if all the locales passed are canonical locales. This will not be the case in the final PR.


Co-authored-by: RageKnify <RageKnify@gmail.com>
@bors
Copy link

bors bot commented Oct 24, 2021

Pull request successfully merged into main.

Build succeeded:

@bors bors bot changed the title Implement prototype of Intl built-in [Merged by Bors] - Implement prototype of Intl built-in Oct 24, 2021
@bors bors bot closed this Oct 24, 2021
@Razican Razican added the hacktoberfest-accepted PR accepted for Hacktoberfest label Oct 30, 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 hacktoberfest-accepted PR accepted for Hacktoberfest
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants