Skip to content

Commit f18b054

Browse files
authored
Merge branch 'master' into 2021-08-cleanup-InitializeDateTimeFormat
2 parents 0836725 + 233d29c commit f18b054

13 files changed

+172
-147
lines changed

spec/collator.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ <h1>CompareStrings ( _collator_, _x_, _y_ )</h1>
243243
</p>
244244

245245
<p>
246-
The actual return values are implementation-defined to permit implementers to encode additional information in the value. The method is required to return *+0*<sub>𝔽</sub> when comparing Strings that are considered canonically equivalent by the Unicode standard.
246+
The actual return values are implementation-defined to permit implementers to encode additional information in the value. The method is required to return *+0*<sub>𝔽</sub> when comparing Strings that are considered canonically equivalent by the Unicode Standard.
247247
</p>
248248

249249
<emu-note>

spec/datetimeformat.html

Lines changed: 34 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -73,18 +73,37 @@ <h1>InitializeDateTimeFormat ( _dateTimeFormat_, _locales_, _options_ )</h1>
7373
1. Set _dateTimeFormat_.[[Locale]] to _r_.[[locale]].
7474
1. Set _calendar_ to _r_.[[ca]].
7575
1. Set _dateTimeFormat_.[[Calendar]] to _calendar_.
76-
1. Set _dateTimeFormat_.[[HourCycle]] to _r_.[[hc]].
7776
1. Set _dateTimeFormat_.[[NumberingSystem]] to _r_.[[nu]].
7877
1. Let _dataLocale_ be _r_.[[dataLocale]].
78+
1. Let _dataLocaleData_ be _localeData_.[[&lt;_dataLocale_&gt;]].
79+
1. Let _hcDefault_ be _dataLocaleData_.[[hourCycle]].
80+
1. If _r_.[[hc]] is *null*, then
81+
1. Let _hc_ be _hcDefault_.
82+
1. If _hour12_ is *true*, then
83+
1. If _hcDefault_ is *"h11"* or *"h23"*, then
84+
1. Let _hc_ be *"h11"*.
85+
1. Else,
86+
1. Let _hc_ be *"h12"*.
87+
1. Else if _hour12_ is *false*, then
88+
1. If _hcDefault_ is *"h11"* or *"h23"*, then
89+
1. Let _hc_ be *"h23"*.
90+
1. Else,
91+
1. Let _hc_ be *"h24"*.
92+
1. Else,
93+
1. Let _hc_ be _r_.[[hc]].
94+
1. Assert: _hour12_ is *undefined*.
95+
1. Set _dateTimeFormat_.[[HourCycle]] to _hc_.
96+
1. Let _formatOptions_ be a new Record.
97+
1. Set _formatOptions_.[[hourCycle]] to _hc_.
7998
1. Let _timeZone_ be ? Get(_options_, *"timeZone"*).
8099
1. If _timeZone_ is *undefined*, then
81100
1. Set _timeZone_ to ! DefaultTimeZone().
82101
1. Else,
83102
1. Set _timeZone_ to ? ToString(_timeZone_).
84-
1. If ! IsValidTimeZoneName(_timeZone_) is *false*, throw a *RangeError* exception.
103+
1. If the result of ! IsValidTimeZoneName(_timeZone_) is *false*, then
104+
1. Throw a *RangeError* exception.
85105
1. Set _timeZone_ to ! CanonicalizeTimeZoneName(_timeZone_).
86106
1. Set _dateTimeFormat_.[[TimeZone]] to _timeZone_.
87-
1. Let _formatOptions_ be a new Record.
88107
1. Let _hasExplicitFormatComponents_ be *false*.
89108
1. For each row of <emu-xref href="#table-datetimeformat-components"></emu-xref>, except the header row, in table order, do
90109
1. Let _prop_ be the name given in the Property column of the row.
@@ -94,33 +113,16 @@ <h1>InitializeDateTimeFormat ( _dateTimeFormat_, _locales_, _options_ )</h1>
94113
1. Let _values_ be a List whose elements are the strings given in the Values column of the row.
95114
1. Let _value_ be ? GetOption(_options_, _prop_, *"string"*, _values_, *undefined*).
96115
1. Set _formatOptions_.[[&lt;_prop_&gt;]] to _value_.
97-
1. If _value_ is not *undefined*, set _hasExplicitFormatComponents_ to *true*.
98-
1. Let _dataLocaleData_ be _localeData_.[[&lt;_dataLocale_&gt;]].
99-
1. Let _hcDefault_ be _dataLocaleData_.[[hourCycle]].
100-
1. Let _hc_ be _dateTimeFormat_.[[HourCycle]].
101-
1. If _hc_ is *null*, then
102-
1. Set _hc_ to _hcDefault_.
103-
1. If _hour12_ is *true*, then
104-
1. If _hcDefault_ is *"h11"* or *"h23"*, then
105-
1. Set _hc_ to *"h11"*.
106-
1. Else,
107-
1. Set _hc_ to *"h12"*.
108-
1. Else if _hour12_ is *false*, then
109-
1. If _hcDefault_ is *"h11"* or *"h23"*, then
110-
1. Set _hc_ to *"h23"*.
111-
1. Else,
112-
1. Set _hc_ to *"h24"*.
113-
1. Else,
114-
1. Assert: _hour12_ is *undefined*.
115-
1. Set _dateTimeFormat_.[[HourCycle]] to _hc_.
116-
1. Set _formatOptions_.[[hourCycle]] to _hc_.
116+
1. If _value_ is not *undefined*, then
117+
1. Set _hasExplicitFormatComponents_ to *true*.
117118
1. Let _matcher_ be ? GetOption(_options_, *"formatMatcher"*, *"string"*, &laquo; *"basic"*, *"best fit"* &raquo;, *"best fit"*).
118119
1. Let _dateStyle_ be ? GetOption(_options_, *"dateStyle"*, *"string"*, &laquo; *"full"*, *"long"*, *"medium"*, *"short"* &raquo;, *undefined*).
119120
1. Set _dateTimeFormat_.[[DateStyle]] to _dateStyle_.
120121
1. Let _timeStyle_ be ? GetOption(_options_, *"timeStyle"*, *"string"*, &laquo; *"full"*, *"long"*, *"medium"*, *"short"* &raquo;, *undefined*).
121122
1. Set _dateTimeFormat_.[[TimeStyle]] to _timeStyle_.
122123
1. If _dateStyle_ is not *undefined* or _timeStyle_ is not *undefined*, then
123-
1. If _hasExplicitFormatComponents_ is *true*, throw a *TypeError* exception.
124+
1. If _hasExplicitFormatComponents_ is *true*, then
125+
1. Throw a *TypeError* exception.
124126
1. Let _styles_ be _dataLocaleData_.[[styles]].[[&lt;_calendar_&gt;]].
125127
1. Let _bestFormat_ be DateTimeStyleFormat(_dateStyle_, _timeStyle_, _styles_).
126128
1. Else,
@@ -760,7 +762,7 @@ <h1>ToDateTimeOptions ( _options_, _required_, _defaults_ )</h1>
760762

761763
<emu-alg>
762764
1. If _options_ is *undefined*, let _options_ be *null*; otherwise let _options_ be ? ToObject(_options_).
763-
1. Let _options_ be OrdinaryObjectCreate(_options_).
765+
1. Let _options_ be ! OrdinaryObjectCreate(_options_).
764766
1. Let _needDefaults_ be *true*.
765767
1. If _required_ is *"date"* or *"any"*, then
766768
1. For each property name _prop_ of &laquo; *"weekday"*, *"year"*, *"month"*, *"day"* &raquo;, do
@@ -919,16 +921,16 @@ <h1>FormatDateTimePattern ( _dateTimeFormat_, _patternParts_, _x_, _rangeFormatO
919921
1. Let _x_ be TimeClip(_x_).
920922
1. If _x_ is *NaN*, throw a *RangeError* exception.
921923
1. Let _locale_ be _dateTimeFormat_.[[Locale]].
922-
1. Let _nfOptions_ be OrdinaryObjectCreate(*null*).
924+
1. Let _nfOptions_ be ! OrdinaryObjectCreate(*null*).
923925
1. Perform ! CreateDataPropertyOrThrow(_nfOptions_, *"useGrouping"*, *false*).
924926
1. Let _nf_ be ? Construct(%NumberFormat%, &laquo; _locale_, _nfOptions_ &raquo;).
925-
1. Let _nf2Options_ be OrdinaryObjectCreate(*null*).
927+
1. Let _nf2Options_ be ! OrdinaryObjectCreate(*null*).
926928
1. Perform ! CreateDataPropertyOrThrow(_nf2Options_, *"minimumIntegerDigits"*, 2).
927929
1. Perform ! CreateDataPropertyOrThrow(_nf2Options_, *"useGrouping"*, *false*).
928930
1. Let _nf2_ be ? Construct(%NumberFormat%, &laquo; _locale_, _nf2Options_ &raquo;).
929931
1. Let _fractionalSecondDigits_ be _dateTimeFormat_.[[FractionalSecondDigits]].
930932
1. If _fractionalSecondDigits_ is not *undefined*, then
931-
1. Let _nf3Options_ be OrdinaryObjectCreate(*null*).
933+
1. Let _nf3Options_ be ! OrdinaryObjectCreate(*null*).
932934
1. Perform ! CreateDataPropertyOrThrow(_nf3Options_, *"minimumIntegerDigits"*, _fractionalSecondDigits_).
933935
1. Perform ! CreateDataPropertyOrThrow(_nf3Options_, *"useGrouping"*, *false*).
934936
1. Let _nf3_ be ? Construct(%NumberFormat%, &laquo; _locale_, _nf3Options_ &raquo;).
@@ -1039,10 +1041,10 @@ <h1>FormatDateTimeToParts ( _dateTimeFormat_, _x_ )</h1>
10391041

10401042
<emu-alg>
10411043
1. Let _parts_ be ? PartitionDateTimePattern(_dateTimeFormat_, _x_).
1042-
1. Let _result_ be ArrayCreate(0).
1044+
1. Let _result_ be ! ArrayCreate(0).
10431045
1. Let _n_ be 0.
10441046
1. For each Record { [[Type]], [[Value]] } _part_ in _parts_, do
1045-
1. Let _O_ be OrdinaryObjectCreate(%Object.prototype%).
1047+
1. Let _O_ be ! OrdinaryObjectCreate(%Object.prototype%).
10461048
1. Perform ! CreateDataPropertyOrThrow(_O_, *"type"*, _part_.[[Type]]).
10471049
1. Perform ! CreateDataPropertyOrThrow(_O_, *"value"*, _part_.[[Value]]).
10481050
1. Perform ! CreateDataProperty(_result_, ! ToString(_n_), _O_).
@@ -1152,10 +1154,10 @@ <h1>FormatDateTimeRangeToParts ( _dateTimeFormat_, _x_, _y_ )</h1>
11521154

11531155
<emu-alg>
11541156
1. Let _parts_ be ? PartitionDateTimeRangePattern(_dateTimeFormat_, _x_, _y_).
1155-
1. Let _result_ be ArrayCreate(0).
1157+
1. Let _result_ be ! ArrayCreate(0).
11561158
1. Let _n_ be 0.
11571159
1. For each Record { [[Type]], [[Value]], [[Source]] } _part_ in _parts_, do
1158-
1. Let _O_ be OrdinaryObjectCreate(%ObjectPrototype%).
1160+
1. Let _O_ be ! OrdinaryObjectCreate(%Object.prototype%).
11591161
1. Perform ! CreateDataPropertyOrThrow(_O_, *"type"*, _part_.[[Type]]).
11601162
1. Perform ! CreateDataPropertyOrThrow(_O_, *"value"*, _part_.[[Value]]).
11611163
1. Perform ! CreateDataPropertyOrThrow(_O_, *"source"*, _part_.[[Source]]).

spec/displaynames.html

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -248,33 +248,32 @@ <h1>Abstract Operations for DisplayNames Objects</h1>
248248
<emu-clause id="sec-canonicalcodefordisplaynames" aoid="CanonicalCodeForDisplayNames">
249249
<h1>CanonicalCodeForDisplayNames ( _type_, _code_ )</h1>
250250
<p>
251-
The CanonicalCodeForDisplayNames abstract operation is called with arguments _type_ and _code_. It verifies that the _code_ argument represents a well-formed code according to the _type_ argument and returns the case-regularized form of the _code_. The algorithm refers to <a href="https://www.unicode.org/reports/tr35/#Identifiers">UTS 35's Unicode Language and Locale Identifiers grammar</a>. The following steps are taken:
251+
The CanonicalCodeForDisplayNames abstract operation takes arguments _type_ (a String) and _code_ (a String). It verifies that the _code_ argument represents a well-formed code according to the _type_ argument and returns the case-regularized form of the _code_. The algorithm refers to <a href="https://www.unicode.org/reports/tr35/#Identifiers">UTS 35's Unicode Language and Locale Identifiers grammar</a>. The following steps are taken:
252252
</p>
253253
<emu-alg>
254254
1. If _type_ is *"language"*, then
255255
1. If _code_ does not match the `unicode_language_id` production, throw a *RangeError* exception.
256-
1. If IsStructurallyValidLanguageTag(_code_) is *false*, throw a *RangeError* exception.
257-
1. Set _code_ to CanonicalizeUnicodeLocaleId(_code_).
258-
1. Return _code_.
256+
1. If ! IsStructurallyValidLanguageTag(_code_) is *false*, throw a *RangeError* exception.
257+
1. Return ! CanonicalizeUnicodeLocaleId(_code_).
259258
1. If _type_ is *"region"*, then
260259
1. If _code_ does not match the `unicode_region_subtag` production, throw a *RangeError* exception.
261-
1. Let _code_ be the result of mapping _code_ to upper case as described in <emu-xref href="#sec-case-sensitivity-and-case-mapping"></emu-xref>.
262-
1. Return _code_.
260+
1. Return the ASCII-uppercase of _code_.
263261
1. If _type_ is *"script"*, then
264262
1. If _code_ does not match the `unicode_script_subtag` production, throw a *RangeError* exception.
265-
1. Let _code_ be the result of mapping the first character in _code_ to upper case, and mapping the second, third, and fourth character in _code_ to lower case, as described in <emu-xref href="#sec-case-sensitivity-and-case-mapping"></emu-xref>.
266-
1. Return _code_.
263+
1. Assert: The length of _code_ is 4, and every code unit of _code_ represents an ASCII letter (0x0041 through 0x005A and 0x0061 through 0x007A, both inclusive).
264+
1. Let _first_ be the ASCII-uppercase of the substring of _code_ from 0 to 1.
265+
1. Let _rest_ be the ASCII-lowercase of the substring of _code_ from 1.
266+
1. Return the string-concatenation of _first_ and _rest_.
267267
1. If _type_ is *"calendar"*, then
268268
1. If _code_ does not match the Unicode Locale Identifier `type` nonterminal, throw a *RangeError* exception.
269-
1. Let _code_ be the result of mapping _code_ to lower case as described in <emu-xref href="#sec-case-sensitivity-and-case-mapping"></emu-xref>.
270-
1. Return _code_.
269+
1. If _code_ uses any of the backwards compatibility syntax described in <a href="https://unicode.org/reports/tr35/#BCP_47_Conformance">Unicode Technical Standard #35 LDML § 3.3 BCP 47 Conformance</a>, throw a *RangeError* exception.
270+
1. Return the ASCII-lowercase of _code_.
271271
1. If _type_ is *"dateTimeField"*, then
272272
1. If the result of IsValidDateTimeFieldCode(_code_) is *false*, throw a *RangeError* exception.
273273
1. Return _code_.
274274
1. Assert: _type_ is *"currency"*.
275275
1. If ! IsWellFormedCurrencyCode(_code_) is *false*, throw a *RangeError* exception.
276-
1. Let _code_ be the result of mapping _code_ to upper case as described in <emu-xref href="#sec-case-sensitivity-and-case-mapping"></emu-xref>.
277-
1. Return _code_.
276+
1. Return the ASCII-uppercase of _code_.
278277
</emu-alg>
279278
</emu-clause>
280279

spec/intl.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ <h1>Intl.getCanonicalLocales ( _locales_ )</h1>
114114

115115
<emu-alg>
116116
1. Let _ll_ be ? CanonicalizeLocaleList(_locales_).
117-
1. Return CreateArrayFromList(_ll_).
117+
1. Return ! CreateArrayFromList(_ll_).
118118
</emu-alg>
119119
</emu-clause>
120120
</emu-clause>

spec/listformat.html

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ <h1>Intl.ListFormat.prototype.format ( _list_ )</h1>
142142
1. Let _lf_ be the *this* value.
143143
1. Perform ? RequireInternalSlot(_lf_, [[InitializedListFormat]]).
144144
1. Let _stringList_ be ? StringListFromIterable(_list_).
145-
1. Return FormatList(_lf_, _stringList_).
145+
1. Return ! FormatList(_lf_, _stringList_).
146146
</emu-alg>
147147
</emu-clause>
148148

@@ -157,7 +157,7 @@ <h1>Intl.ListFormat.prototype.formatToParts ( _list_ )</h1>
157157
1. Let _lf_ be the *this* value.
158158
1. Perform ? RequireInternalSlot(_lf_, [[InitializedListFormat]]).
159159
1. Let _stringList_ be ? StringListFromIterable(_list_).
160-
1. Return FormatListToParts(_lf_, _stringList_).
160+
1. Return ! FormatListToParts(_lf_, _stringList_).
161161
</emu-alg>
162162
</emu-clause>
163163

@@ -259,7 +259,7 @@ <h1>DeconstructPattern ( _pattern_, _placeables_ )</h1>
259259
&raquo;
260260
</pre>
261261
<emu-alg>
262-
1. Let _patternParts_ be PartitionPattern(_pattern_).
262+
1. Let _patternParts_ be ! PartitionPattern(_pattern_).
263263
1. Let _result_ be a new empty List.
264264
1. For each Record { [[Type]], [[Value]] } _patternPart_ of _patternParts_, do
265265
1. Let _part_ be _patternPart_.[[Type]].
@@ -296,7 +296,7 @@ <h1>CreatePartsFromList ( _listFormat_, _list_ )</h1>
296296
1. Let _first_ be a new Record { [[Type]]: *"element"*, [[Value]]: _list_[0] }.
297297
1. Let _second_ be a new Record { [[Type]]: *"element"*, [[Value]]: _list_[1] }.
298298
1. Let _placeables_ be a new Record { [[0]]: _first_, [[1]]: _second_ }.
299-
1. Return DeconstructPattern(_pattern_, _placeables_).
299+
1. Return ! DeconstructPattern(_pattern_, _placeables_).
300300
1. Let _last_ be a new Record { [[Type]]: *"element"*, [[Value]]: _list_[_size_ - 1] }.
301301
1. Let _parts_ be &laquo; _last_ &raquo;.
302302
1. Let _i_ be _size_ - 2.
@@ -310,7 +310,7 @@ <h1>CreatePartsFromList ( _listFormat_, _list_ )</h1>
310310
1. Else,
311311
1. Let _pattern_ be _listFormat_.[[Templates]][_n_].[[End]].
312312
1. Let _placeables_ be a new Record { [[0]]: _head_, [[1]]: _parts_ }.
313-
1. Set _parts_ to DeconstructPattern(_pattern_, _placeables_).
313+
1. Set _parts_ to ! DeconstructPattern(_pattern_, _placeables_).
314314
1. Decrement _i_ by 1.
315315
1. Return _parts_.
316316
</emu-alg>
@@ -328,7 +328,7 @@ <h1>FormatList ( _listFormat_, _list_ )</h1>
328328
</p>
329329

330330
<emu-alg>
331-
1. Let _parts_ be CreatePartsFromList(_listFormat_, _list_).
331+
1. Let _parts_ be ! CreatePartsFromList(_listFormat_, _list_).
332332
1. Let _result_ be an empty String.
333333
1. For each Record { [[Type]], [[Value]] } _part_ in _parts_, do
334334
1. Set _result_ to the string-concatenation of _result_ and _part_.[[Value]].
@@ -344,11 +344,11 @@ <h1>FormatListToParts ( _listFormat_, _list_ )</h1>
344344
</p>
345345

346346
<emu-alg>
347-
1. Let _parts_ be CreatePartsFromList(_listFormat_, _list_).
348-
1. Let _result_ be ArrayCreate(0).
347+
1. Let _parts_ be ! CreatePartsFromList(_listFormat_, _list_).
348+
1. Let _result_ be ! ArrayCreate(0).
349349
1. Let _n_ be 0.
350350
1. For each Record { [[Type]], [[Value]] } _part_ in _parts_, do
351-
1. Let _O_ be OrdinaryObjectCreate(%Object.prototype%).
351+
1. Let _O_ be ! OrdinaryObjectCreate(%Object.prototype%).
352352
1. Perform ! CreateDataPropertyOrThrow(_O_, *"type"*, _part_.[[Type]]).
353353
1. Perform ! CreateDataPropertyOrThrow(_O_, *"value"*, _part_.[[Value]]).
354354
1. Perform ! CreateDataPropertyOrThrow(_result_, ! ToString(_n_), _O_).

0 commit comments

Comments
 (0)