[webkit-changes] [WebKit/WebKit] 7e05da: [JSC] Support Intl.NumberFormat's FormatApproximat...

Yusuke Suzuki noreply at github.com
Mon Aug 7 11:18:24 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 7e05da12ab1da52fe09ec20a4157240cab4457d9
      https://github.com/WebKit/WebKit/commit/7e05da12ab1da52fe09ec20a4157240cab4457d9
  Author: Yusuke Suzuki <ysuzuki at apple.com>
  Date:   2023-08-07 (Mon, 07 Aug 2023)

  Changed paths:
    A JSTests/stress/intl-numberformat-approximately-sign.js
    M Source/JavaScriptCore/runtime/IntlNumberFormat.cpp

  Log Message:
  -----------
  [JSC] Support Intl.NumberFormat's FormatApproximately operation
https://bugs.webkit.org/show_bug.cgi?id=259869
rdar://113461245

Reviewed by Mark Lam.

This patch supports Intl.NumberFormats's FormatApproximately operation[1].
This happens when start and end are *practically-equal* (spec-term) like `formatRangeToParts(1, 1)`.

The problem is that this approximatelySign formatRangeToParts parsing is only supported after ICU 71.
In this patch, we switch the implementation at runtime, and we support FormatApproximately only when
it is ICU 71~. Otherwise, we go to the old path.

[1]: https://tc39.es/ecma402/#sec-formatapproximately

* JSTests/stress/intl-numberformat-approximately-sign.js: Added.
(shouldBe):
(vm.icuVersion):
(else.shouldBe.JSON.stringify.fmt.formatRangeToParts):
* Source/JavaScriptCore/runtime/IntlNumberFormat.cpp:
(JSC::partTypeString):
(JSC::IntlNumberFormat::formatRangeToParts const):

Canonical link: https://commits.webkit.org/266645@main




More information about the webkit-changes mailing list