Skip to content
This repository has been archived by the owner on Jan 25, 2022. It is now read-only.

Commit

Permalink
Use GetOption abstract operation to retrieve option values
Browse files Browse the repository at this point in the history
  • Loading branch information
anba committed Feb 6, 2018
1 parent 637d9c9 commit aedbbbc
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,22 +69,19 @@ <h1>ApplyOptionsToTag( _tag_, _options_ )</h1>
1. Assert: Type(_tag_) is String.
1. If IsStructurallyValidLanguageTag(_tag_) is *false*, throw a *RangeError* exception.
1. If _tag_ matches the `langtag` production, then
1. Let _language_ be ? Get(_options_, `"language"`).
1. Let _language_ be ? GetOption(_options_, `"language"`, `"string"`, *undefined*, *undefined*).
1. If _language_ is not *undefined*, then
1. Set _language_ to ? ToString(_language_).
1. If _language_ does not match the `language` production, throw a *RangeError* exception.
1. Set _tag_ to _tag_ with the substring corresponding to the `language` production replaced by the string _language_.
1. Let _script_ be ? Get(_options_, `"script"`).
1. Let _script_ be ? GetOption(_options_, `"script"`, `"string"`, *undefined*, *undefined*).
1. If _script_ is not *undefined*, then
1. Set _script_ to ? ToString(_script_).
1. If _script_ does not match the `script` production, throw a *RangeError* exception.
1. If _tag_ does not contain a `script` production, then
1. Set _tag_ to the concatenation of the `language` production of _tag_, `"-"`, _script_, and the rest of _tag_.
1. Else,
1. Set _tag_ to _tag_ with the substring corresponding to the `script` production replaced by the string _script_.
1. Let _region_ be ? Get(_options_, `"region"`).
1. Let _region_ be ? GetOption(_options_, `"region"`, `"string"`, *undefined*, *undefined*).
1. If _region_ is not *undefined*, then
1. Set _region_ to ? ToString(_region_).
1. If _region_ does not match the `region` production, throw a *RangeError* exception.
1. If _tag_ does not contain a `region` production, then
1. Set _tag_ to the concatenation of the `language` production of _tag_, the substring corresponding to the `"-" script` production if present, `"-"`, _region_, and the rest of _tag_.
Expand Down Expand Up @@ -176,11 +173,9 @@ <h1>Intl.Locale( _tag_ [, _options_] )</h1>
1. Let _requestedLocales_ be ? CreateArrayFromList(&laquo; _tag_ &raquo;).
1. Let _opt_ be a new Record.
1. Set _opt_.[[localeMatcher]] to `"best fit"`.
1. Let _calendar_ be ? Get(_options_, `"calendar"`).
1. If _calendar_ is not *undefined*, set _calendar_ to ? ToString(_calendar_).
1. Let _calendar_ be ? GetOption(_options_, `"calendar"`, `"string"`, *undefined*, *undefined*).
1. Set _opt_.[[ca]] to _calendar_.
1. Let _collation_ be ? Get(_options_, `"collation"`).
1. If _collation_ is not *undefined*, set _collation_ to ? ToString(_collation_).
1. Let _collation_ be ? GetOption(_options_, `"collation"`, `"string"`, *undefined*, *undefined*).
1. Set _opt_.[[co]] to _collation_.
1. Let _hc_ be ? GetOption(_options_, `"hourCycle"`, `"string"`, &laquo; `"h11"`, `"h12"`, `"h23"`, `"h24"` &raquo;, *undefined*).
1. Set _opt_.[[hc]] to _hc_.
Expand All @@ -189,8 +184,7 @@ <h1>Intl.Locale( _tag_ [, _options_] )</h1>
1. Let _kn_ be ? GetOption(_options_, `"numeric"`, `"boolean"`, *undefined*, *undefined*).
1. If _kn_ is not *undefined*, set _kn_ to ! ToString(_kn_).
1. Set _opt_.[[kn]] to _kn_.
1. Let _numberingSystem_ be ? Get(_options_, `"numberingSystem"`).
1. If _numberingSystem_ is not *undefined*, set _numberingSystem_ to ? ToString(_numeringSystem_).
1. Let _numberingSystem_ be ? GetOption(_options_, `"numberingSystem"`, `"string"`, *undefined*, *undefined*).
1. Set _opt_.[[nu]] to _numeringSystem_.
1. Let _localeData_ be %Locale%.[[LocaleData]].
1. Let _r_ be ResolveLocale( %Locale%.[[AvailableLocales]], _requestedLocales_, _opt_, %Locale%.[[RelevantExtensionKeys]], _localeData_).
Expand Down

0 comments on commit aedbbbc

Please sign in to comment.