From 5a43090da4d137f4499b6f83ed8144012ca8dbf2 Mon Sep 17 00:00:00 2001 From: Frank Yung-Fong Tang Date: Tue, 3 Oct 2023 14:36:05 -0700 Subject: [PATCH] Normative: Fix order of rounding* option reads and resolvedOptions() Ref #768 * Read "roundingIncrement", "roundingMode", "roundingPriority", "trailingZeroDisplay" in alphabetic order. * Output "pluralCategories", "roundingIncrement", "roundingMode", "roundingPriority", "trailingZeroDisplay" in alphabetic order. --- spec/numberformat.html | 10 +++++----- spec/pluralrules.html | 26 +++++++++++++++----------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/spec/numberformat.html b/spec/numberformat.html index 2c3cb6fa..c13c50ed 100644 --- a/spec/numberformat.html +++ b/spec/numberformat.html @@ -113,10 +113,10 @@

1. Let _mnsd_ be ? Get(_options_, *"minimumSignificantDigits"*). 1. Let _mxsd_ be ? Get(_options_, *"maximumSignificantDigits"*). 1. Set _intlObj_.[[MinimumIntegerDigits]] to _mnid_. - 1. Let _roundingPriority_ be ? GetOption(_options_, *"roundingPriority"*, ~string~, « *"auto"*, *"morePrecision"*, *"lessPrecision"* », *"auto"*). 1. Let _roundingIncrement_ be ? GetNumberOption(_options_, *"roundingIncrement"*, 1, 5000, 1). 1. If _roundingIncrement_ is not in « 1, 2, 5, 10, 20, 25, 50, 100, 200, 250, 500, 1000, 2000, 2500, 5000 », throw a *RangeError* exception. 1. Let _roundingMode_ be ? GetOption(_options_, *"roundingMode"*, ~string~, « *"ceil"*, *"floor"*, *"expand"*, *"trunc"*, *"halfCeil"*, *"halfFloor"*, *"halfExpand"*, *"halfTrunc"*, *"halfEven"* », *"halfExpand"*). + 1. Let _roundingPriority_ be ? GetOption(_options_, *"roundingPriority"*, ~string~, « *"auto"*, *"morePrecision"*, *"lessPrecision"* », *"auto"*). 1. Let _trailingZeroDisplay_ be ? GetOption(_options_, *"trailingZeroDisplay"*, ~string~, « *"auto"*, *"stripIfInteger"* », *"auto"*). 1. NOTE: All fields required by SetNumberFormatDigitOptions have now been read from _options_. The remainder of this AO interprets the options and may throw exceptions. 1. If _roundingIncrement_ is not 1, set _mxfdDefault_ to _mnfdDefault_. @@ -490,14 +490,14 @@

Intl.NumberFormat.prototype.resolvedOptions ( )

[[SignDisplay]] *"signDisplay"* - - [[RoundingMode]] - *"roundingMode"* - [[RoundingIncrement]] *"roundingIncrement"* + + [[RoundingMode]] + *"roundingMode"* + [[ComputedRoundingPriority]] *"roundingPriority"* diff --git a/spec/pluralrules.html b/spec/pluralrules.html index deabaf69..a569f34f 100644 --- a/spec/pluralrules.html +++ b/spec/pluralrules.html @@ -172,19 +172,15 @@

Intl.PluralRules.prototype.resolvedOptions ( )

1. Let _pr_ be the *this* value. 1. Perform ? RequireInternalSlot(_pr_, [[InitializedPluralRules]]). 1. Let _options_ be OrdinaryObjectCreate(%Object.prototype%). + 1. Let _pluralCategories_ be a List of Strings containing all possible results of PluralRuleSelect for the selected locale _pr_.[[Locale]]. 1. For each row of , except the header row, in table order, do 1. Let _p_ be the Property value of the current row. - 1. Let _v_ be the value of _pr_'s internal slot whose name is the Internal Slot value of the current row. + 1. If _p_ is *"pluralCategories"*, then + 1. Let _v_ be CreateArrayFromList(_pluralCategories_). + 1. Else, + 1. Let _v_ be the value of _pr_'s internal slot whose name is the Internal Slot value of the current row. 1. If _v_ is not *undefined*, then 1. Perform ! CreateDataPropertyOrThrow(_options_, _p_, _v_). - 1. Let _pluralCategories_ be a List of Strings containing all possible results of PluralRuleSelect for the selected locale _pr_.[[Locale]]. - 1. Perform ! CreateDataProperty(_options_, *"pluralCategories"*, CreateArrayFromList(_pluralCategories_)). - 1. If _pr_.[[RoundingType]] is ~morePrecision~, then - 1. Perform ! CreateDataPropertyOrThrow(_options_, *"roundingPriority"*, *"morePrecision"*). - 1. Else if _pr_.[[RoundingType]] is ~lessPrecision~, then - 1. Perform ! CreateDataPropertyOrThrow(_options_, *"roundingPriority"*, *"lessPrecision"*). - 1. Else, - 1. Perform ! CreateDataPropertyOrThrow(_options_, *"roundingPriority"*, *"auto"*). 1. Return _options_. @@ -226,13 +222,21 @@

Intl.PluralRules.prototype.resolvedOptions ( )

*"maximumSignificantDigits"* - [[RoundingMode]] - *"roundingMode"* + + *"pluralCategories"* [[RoundingIncrement]] *"roundingIncrement"* + + [[RoundingMode]] + *"roundingMode"* + + + [[ComputedRoundingPriority]] + *"roundingPriority"* + [[TrailingZeroDisplay]] *"trailingZeroDisplay"*