Skip to content

Commit 2daa386

Browse files
committed
Editorial: Use ResolveOptions for remaining service constructors
1 parent a4437bf commit 2daa386

File tree

6 files changed

+12
-46
lines changed

6 files changed

+12
-46
lines changed

spec/durationformat.html

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,8 @@ <h1>Intl.DurationFormat ( [ _locales_ [ , _options_ ] ] )</h1>
1414
<emu-alg>
1515
1. If NewTarget is *undefined*, throw a *TypeError* exception.
1616
1. Let _durationFormat_ be ? OrdinaryCreateFromConstructor(NewTarget, *"%Intl.DurationFormatPrototype%"*, « [[InitializedDurationFormat]], [[Locale]], [[NumberingSystem]], [[Style]], [[YearsOptions]], [[MonthsOptions]], [[WeeksOptions]], [[DaysOptions]], [[HoursOptions]], [[MinutesOptions]], [[SecondsOptions]], [[MillisecondsOptions]], [[MicrosecondsOptions]], [[NanosecondsOptions]], [[HourMinuteSeparator]], [[MinuteSecondSeparator]], [[FractionalDigits]] »).
17-
1. Let _requestedLocales_ be ? CanonicalizeLocaleList(_locales_).
18-
1. Let _options_ be ? GetOptionsObject(_options_).
19-
1. Let _matcher_ be ? GetOption(_options_, *"localeMatcher"*, ~string~, « *"lookup"*, *"best fit"* », *"best fit"*).
20-
1. Let _numberingSystem_ be ? GetOption(_options_, *"numberingSystem"*, ~string~, ~empty~, *undefined*).
21-
1. If _numberingSystem_ is not *undefined*, then
22-
1. If _numberingSystem_ cannot be matched by the <code>type</code> Unicode locale nonterminal, throw a *RangeError* exception.
23-
1. Let _opt_ be the Record { [[localeMatcher]]: _matcher_, [[nu]]: _numberingSystem_ }.
24-
1. Let _r_ be ResolveLocale(%Intl.DurationFormat%.[[AvailableLocales]], _requestedLocales_, _opt_, %Intl.DurationFormat%.[[RelevantExtensionKeys]], %Intl.DurationFormat%.[[LocaleData]]).
17+
1. Let _optionsResolution_ be ? ResolveOptions(%Intl.DurationFormat%, %Intl.DurationFormat%.[[LocaleData]], _locales_, _options_).
18+
1. Let _r_ be _optionsResolution_.[[ResolvedLocale]].
2519
1. Set _durationFormat_.[[Locale]] to _r_.[[Locale]].
2620
1. Let _resolvedLocaleData_ be _r_.[[LocaleData]].
2721
1. Let _digitalFormat_ be _resolvedLocaleData_.[[DigitalFormat]].

spec/listformat.html

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,8 @@ <h1>Intl.ListFormat ( [ _locales_ [ , _options_ ] ] )</h1>
1414
<emu-alg>
1515
1. If NewTarget is *undefined*, throw a *TypeError* exception.
1616
1. Let _listFormat_ be ? OrdinaryCreateFromConstructor(NewTarget, *"%Intl.ListFormat.prototype%"*, « [[InitializedListFormat]], [[Locale]], [[Type]], [[Style]], [[Templates]] »).
17-
1. Let _requestedLocales_ be ? CanonicalizeLocaleList(_locales_).
18-
1. Set _options_ to ? GetOptionsObject(_options_).
19-
1. Let _opt_ be a new Record.
20-
1. Let _matcher_ be ? GetOption(_options_, *"localeMatcher"*, ~string~, « *"lookup"*, *"best fit"* », *"best fit"*).
21-
1. Set _opt_.[[localeMatcher]] to _matcher_.
22-
1. Let _r_ be ResolveLocale(%Intl.ListFormat%.[[AvailableLocales]], _requestedLocales_, _opt_, %Intl.ListFormat%.[[RelevantExtensionKeys]], %Intl.ListFormat%.[[LocaleData]]).
17+
1. Let _optionsResolution_ be ? ResolveOptions(%Intl.ListFormat%, %Intl.ListFormat%.[[LocaleData]], _locales_, _options_).
18+
1. Let _r_ be _optionsResolution_.[[ResolvedLocale]].
2319
1. Set _listFormat_.[[Locale]] to _r_.[[Locale]].
2420
1. Let _type_ be ? GetOption(_options_, *"type"*, ~string~, « *"conjunction"*, *"disjunction"*, *"unit"* », *"conjunction"*).
2521
1. Set _listFormat_.[[Type]] to _type_.

spec/numberformat.html

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,8 @@ <h1>Intl.NumberFormat ( [ _locales_ [ , _options_ ] ] )</h1>
1414
<emu-alg>
1515
1. If NewTarget is *undefined*, let _newTarget_ be the active function object, else let _newTarget_ be NewTarget.
1616
1. Let _numberFormat_ be ? OrdinaryCreateFromConstructor(_newTarget_, *"%Intl.NumberFormat.prototype%"*, « [[InitializedNumberFormat]], [[Locale]], [[LocaleData]], [[NumberingSystem]], [[Style]], [[Unit]], [[UnitDisplay]], [[Currency]], [[CurrencyDisplay]], [[CurrencySign]], [[MinimumIntegerDigits]], [[MinimumFractionDigits]], [[MaximumFractionDigits]], [[MinimumSignificantDigits]], [[MaximumSignificantDigits]], [[RoundingType]], [[Notation]], [[CompactDisplay]], [[UseGrouping]], [[SignDisplay]], [[RoundingIncrement]], [[RoundingMode]], [[ComputedRoundingPriority]], [[TrailingZeroDisplay]], [[BoundFormat]] »).
17-
1. Let _requestedLocales_ be ? CanonicalizeLocaleList(_locales_).
18-
1. Set _options_ to ? CoerceOptionsToObject(_options_).
19-
1. Let _opt_ be a new Record.
20-
1. Let _matcher_ be ? GetOption(_options_, *"localeMatcher"*, ~string~, « *"lookup"*, *"best fit"* », *"best fit"*).
21-
1. Set _opt_.[[localeMatcher]] to _matcher_.
22-
1. Let _numberingSystem_ be ? GetOption(_options_, *"numberingSystem"*, ~string~, ~empty~, *undefined*).
23-
1. If _numberingSystem_ is not *undefined*, then
24-
1. If _numberingSystem_ cannot be matched by the <code>type</code> Unicode locale nonterminal, throw a *RangeError* exception.
25-
1. Set _opt_.[[nu]] to _numberingSystem_.
26-
1. Let _r_ be ResolveLocale(%Intl.NumberFormat%.[[AvailableLocales]], _requestedLocales_, _opt_, %Intl.NumberFormat%.[[RelevantExtensionKeys]], %Intl.NumberFormat%.[[LocaleData]]).
17+
1. Let _optionsResolution_ be ? ResolveOptions(%Intl.NumberFormat%, %Intl.NumberFormat%.[[LocaleData]], _locales_, _options_, « ~coerce-options~ »).
18+
1. Let _r_ be _optionsResolution_.[[ResolvedLocale]].
2719
1. Set _numberFormat_.[[Locale]] to _r_.[[Locale]].
2820
1. Set _numberFormat_.[[LocaleData]] to _r_.[[LocaleData]].
2921
1. Set _numberFormat_.[[NumberingSystem]] to _r_.[[nu]].

spec/pluralrules.html

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,8 @@ <h1>Intl.PluralRules ( [ _locales_ [ , _options_ ] ] )</h1>
1414
<emu-alg>
1515
1. If NewTarget is *undefined*, throw a *TypeError* exception.
1616
1. Let _pluralRules_ be ? OrdinaryCreateFromConstructor(NewTarget, *"%Intl.PluralRules.prototype%"*, « [[InitializedPluralRules]], [[Locale]], [[Type]], [[MinimumIntegerDigits]], [[MinimumFractionDigits]], [[MaximumFractionDigits]], [[MinimumSignificantDigits]], [[MaximumSignificantDigits]], [[RoundingType]], [[RoundingIncrement]], [[RoundingMode]], [[ComputedRoundingPriority]], [[TrailingZeroDisplay]] »).
17-
1. Let _requestedLocales_ be ? CanonicalizeLocaleList(_locales_).
18-
1. Set _options_ to ? CoerceOptionsToObject(_options_).
19-
1. Let _opt_ be a new Record.
20-
1. Let _matcher_ be ? GetOption(_options_, *"localeMatcher"*, ~string~, « *"lookup"*, *"best fit"* », *"best fit"*).
21-
1. Set _opt_.[[localeMatcher]] to _matcher_.
22-
1. Let _r_ be ResolveLocale(%Intl.PluralRules%.[[AvailableLocales]], _requestedLocales_, _opt_, %Intl.PluralRules%.[[RelevantExtensionKeys]], %Intl.PluralRules%.[[LocaleData]]).
17+
1. Let _optionsResolution_ be ? ResolveOptions(%Intl.PluralRules%, %Intl.PluralRules%.[[LocaleData]], _locales_, _options_, « ~coerce-options~ »).
18+
1. Let _r_ be _optionsResolution_.[[ResolvedLocale]].
2319
1. Set _pluralRules_.[[Locale]] to _r_.[[Locale]].
2420
1. Let _t_ be ? GetOption(_options_, *"type"*, ~string~, « *"cardinal"*, *"ordinal"* », *"cardinal"*).
2521
1. Set _pluralRules_.[[Type]] to _t_.

spec/relativetimeformat.html

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,8 @@ <h1>Intl.RelativeTimeFormat ( [ _locales_ [ , _options_ ] ] )</h1>
1414
<emu-alg>
1515
1. If NewTarget is *undefined*, throw a *TypeError* exception.
1616
1. Let _relativeTimeFormat_ be ? OrdinaryCreateFromConstructor(NewTarget, *"%Intl.RelativeTimeFormat.prototype%"*, « [[InitializedRelativeTimeFormat]], [[Locale]], [[LocaleData]], [[Style]], [[Numeric]], [[NumberFormat]], [[NumberingSystem]], [[PluralRules]] »).
17-
1. Let _requestedLocales_ be ? CanonicalizeLocaleList(_locales_).
18-
1. Set _options_ to ? CoerceOptionsToObject(_options_).
19-
1. Let _opt_ be a new Record.
20-
1. Let _matcher_ be ? GetOption(_options_, *"localeMatcher"*, ~string~, « *"lookup"*, *"best fit"* », *"best fit"*).
21-
1. Set _opt_.[[LocaleMatcher]] to _matcher_.
22-
1. Let _numberingSystem_ be ? GetOption(_options_, *"numberingSystem"*, ~string~, ~empty~, *undefined*).
23-
1. If _numberingSystem_ is not *undefined*, then
24-
1. If _numberingSystem_ cannot be matched by the <code>type</code> Unicode locale nonterminal, throw a *RangeError* exception.
25-
1. Set _opt_.[[nu]] to _numberingSystem_.
26-
1. Let _r_ be ResolveLocale(%Intl.RelativeTimeFormat%.[[AvailableLocales]], _requestedLocales_, _opt_, %Intl.RelativeTimeFormat%.[[RelevantExtensionKeys]], %Intl.RelativeTimeFormat%.[[LocaleData]]).
17+
1. Let _optionsResolution_ be ? ResolveOptions(%Intl.RelativeTimeFormat%, %Intl.RelativeTimeFormat%.[[LocaleData]], _locales_, _options_, « ~coerce-options~ »).
18+
1. Let _r_ be _optionsResolution_.[[ResolvedLocale]].
2719
1. Let _locale_ be _r_.[[Locale]].
2820
1. Set _relativeTimeFormat_.[[Locale]] to _locale_.
2921
1. Set _relativeTimeFormat_.[[LocaleData]] to _r_.[[LocaleData]].

spec/segmenter.html

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,8 @@ <h1>Intl.Segmenter ( [ _locales_ [ , _options_ ] ] )</h1>
1515
1. If NewTarget is *undefined*, throw a *TypeError* exception.
1616
1. Let _internalSlotsList_ be « [[InitializedSegmenter]], [[Locale]], [[SegmenterGranularity]] ».
1717
1. Let _segmenter_ be ? OrdinaryCreateFromConstructor(NewTarget, *"%Intl.Segmenter.prototype%"*, _internalSlotsList_).
18-
1. Let _requestedLocales_ be ? CanonicalizeLocaleList(_locales_).
19-
1. Set _options_ to ? GetOptionsObject(_options_).
20-
1. Let _opt_ be a new Record.
21-
1. Let _matcher_ be ? GetOption(_options_, *"localeMatcher"*, ~string~, « *"lookup"*, *"best fit"* », *"best fit"*).
22-
1. Set _opt_.[[localeMatcher]] to _matcher_.
23-
1. Let _r_ be ResolveLocale(%Intl.Segmenter%.[[AvailableLocales]], _requestedLocales_, _opt_, %Intl.Segmenter%.[[RelevantExtensionKeys]], %Intl.Segmenter%.[[LocaleData]]).
18+
1. Let _optionsResolution_ be ? ResolveOptions(%Intl.NumberFormat%, %Intl.NumberFormat%.[[LocaleData]], _locales_, _options_).
19+
1. Let _r_ be _optionsResolution_.[[ResolvedLocale]].
2420
1. Set _segmenter_.[[Locale]] to _r_.[[Locale]].
2521
1. Let _granularity_ be ? GetOption(_options_, *"granularity"*, ~string~, « *"grapheme"*, *"word"*, *"sentence"* », *"grapheme"*).
2622
1. Set _segmenter_.[[SegmenterGranularity]] to _granularity_.

0 commit comments

Comments
 (0)