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

Normative: Add "microsecond" and "nanosecond" to IsSanctionedSingleUnitIdentifier #708

Merged
merged 1 commit into from
Nov 3, 2022

Conversation

FrankYFTang
Copy link
Contributor

@FrankYFTang FrankYFTang changed the title Add "microsecond" and "nanosecond" to IsSanctionedSingleUnitIdentifier Normative: Add "microsecond" and "nanosecond" to IsSanctionedSingleUnitIdentifier Aug 30, 2022
@ryzokuken ryzokuken added c: numbers Component: numbers, currency, units normative labels Aug 30, 2022
trflynn89 added a commit to trflynn89/serenity that referenced this pull request Aug 31, 2022
trflynn89 added a commit to trflynn89/serenity that referenced this pull request Aug 31, 2022
webkit-early-warning-system pushed a commit to Constellation/WebKit that referenced this pull request Sep 23, 2022
https://bugs.webkit.org/show_bug.cgi?id=214794
<rdar://66436701>

Reviewed by Ross Kirsling.

This patch implements Intl.DurationFormat[1], which is now stage-3 feature.
It is decoupled from Temporal now: it can take an object with `hours` etc. properties, and
generate formatted string for duration. In the future, it will accept Temporal.Duration too.

1. We add new microsecond and nanosecond units because they are necessary to DurationFormat[2].
2. Implement Intl.DurationFormat with UNumberFormatter and UListFormatter.

[1]: https://github.com/tc39/proposal-intl-duration-format
[2]: tc39/ecma402#708

* JSTests/stress/intl-durationformat-basic.js: Added.
(shouldBe):
(shouldBeOneOf):
(shouldBeForICUVersion):
(shouldNotThrow):
(shouldThrow):
* JSTests/stress/intl-durationformat-digital.js: Added.
(shouldBe):
(throw.new.Error):
* JSTests/stress/intl-durationformat-format-to-parts.js: Added.
(shouldBe):
(shouldBeOneOf):
(shouldBeForICUVersion):
(shouldNotThrow):
(shouldThrow):
(throw.new.Error):
* JSTests/stress/intl-durationformat.js: Added.
(shouldBe):
(shouldNotThrow):
(shouldThrow):
(test.DerivedDurationFormat):
(test.get shouldThrow):
(test):
* JSTests/stress/intl-enumeration.js:
* JSTests/test262/config.yaml:
* JSTests/test262/expectations.yaml:
* Source/JavaScriptCore/CMakeLists.txt:
* Source/JavaScriptCore/DerivedSources-input.xcfilelist:
* Source/JavaScriptCore/DerivedSources-output.xcfilelist:
* Source/JavaScriptCore/DerivedSources.make:
* Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj:
* Source/JavaScriptCore/Sources.txt:
* Source/JavaScriptCore/heap/Heap.cpp:
(JSC::Heap::Heap):
* Source/JavaScriptCore/heap/Heap.h:
* Source/JavaScriptCore/heap/HeapSubspaceTypes.h:
* Source/JavaScriptCore/runtime/CommonIdentifiers.h:
* Source/JavaScriptCore/runtime/IntlDurationFormat.cpp: Added.
(JSC::IntlDurationFormat::create):
(JSC::IntlDurationFormat::createStructure):
(JSC::IntlDurationFormat::IntlDurationFormat):
(JSC::IntlDurationFormat::finishCreation):
(JSC::intlDurationUnitOptions):
(JSC::displayName):
(JSC::IntlDurationFormat::initializeDurationFormat):
(JSC::ListFormatInput::ListFormatInput):
(JSC::ListFormatInput::size const):
(JSC::ListFormatInput::stringPointers const):
(JSC::ListFormatInput::stringLengths const):
(JSC::retrieveSeparator):
(JSC::collectElements):
(JSC::IntlDurationFormat::format const):
(JSC::IntlDurationFormat::formatToParts const):
(JSC::IntlDurationFormat::resolvedOptions const):
(JSC::IntlDurationFormat::styleString):
(JSC::IntlDurationFormat::unitStyleString):
(JSC::IntlDurationFormat::displayString):
* Source/JavaScriptCore/runtime/IntlDurationFormat.h: Added.
* Source/JavaScriptCore/runtime/IntlDurationFormatConstructor.cpp: Added.
(JSC::IntlDurationFormatConstructor::create):
(JSC::IntlDurationFormatConstructor::createStructure):
(JSC::IntlDurationFormatConstructor::IntlDurationFormatConstructor):
(JSC::IntlDurationFormatConstructor::finishCreation):
(JSC::JSC_DEFINE_HOST_FUNCTION):
* Source/JavaScriptCore/runtime/IntlDurationFormatConstructor.h: Added.
* Source/JavaScriptCore/runtime/IntlDurationFormatPrototype.cpp: Added.
(JSC::IntlDurationFormatPrototype::create):
(JSC::IntlDurationFormatPrototype::createStructure):
(JSC::IntlDurationFormatPrototype::IntlDurationFormatPrototype):
(JSC::IntlDurationFormatPrototype::finishCreation):
(JSC::JSC_DEFINE_HOST_FUNCTION):
* Source/JavaScriptCore/runtime/IntlDurationFormatPrototype.h: Added.
* Source/JavaScriptCore/runtime/IntlObject.cpp:
(JSC::createDurationFormatConstructor):
(JSC::IntlObject::finishCreation):
* Source/JavaScriptCore/runtime/IntlObject.h:
(JSC::intlDurationFormatAvailableLocales):
* Source/JavaScriptCore/runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::init):
* Source/JavaScriptCore/runtime/JSGlobalObject.h:
(JSC::JSGlobalObject::durationFormatStructure):

Canonical link: https://commits.webkit.org/254791@main
@ryzokuken
Copy link
Member

@ryzokuken ryzokuken merged commit f627573 into master Nov 3, 2022
@ryzokuken ryzokuken deleted the FrankYFTang-patch-2 branch November 3, 2022 17:36
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Nov 10, 2022
…dminor

Steps performed:
- Add "microsecond" and "nanosecond" to "intl/icu/data_filter.json".
- Run "icu_sources_data.py" to update the ICU data file.
- Run "update-tzdata.sh" to reapply the tzdata 2022f changes.
- Add "microsecond" and "nanosecond" to "SanctionedSimpleUnitIdentifiers.yaml".
- Run "make_intl_data.py units" to regenerate additional SpiderMonkey files.

Spec PR: tc39/ecma402#708

Differential Revision: https://phabricator.services.mozilla.com/D161676
jamienicol pushed a commit to jamienicol/gecko that referenced this pull request Nov 11, 2022
…dminor

Steps performed:
- Add "microsecond" and "nanosecond" to "intl/icu/data_filter.json".
- Run "icu_sources_data.py" to update the ICU data file.
- Run "update-tzdata.sh" to reapply the tzdata 2022f changes.
- Add "microsecond" and "nanosecond" to "SanctionedSimpleUnitIdentifiers.yaml".
- Run "make_intl_data.py units" to regenerate additional SpiderMonkey files.

Spec PR: tc39/ecma402#708

Differential Revision: https://phabricator.services.mozilla.com/D161676
Clownsw pushed a commit to Clownsw/v8 that referenced this pull request Nov 18, 2022
Implement 402 PR708
tc39/ecma402#708

Bug: v8:13506
Change-Id: I9705e3b2f0bc36c8a34f84de757f69546db28da4
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4035495
Reviewed-by: Shu-yu Guo <syg@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#84346}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: numbers Component: numbers, currency, units normative
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants