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

Commit

Permalink
Change an unreachable condition to an assertion
Browse files Browse the repository at this point in the history
InsertUnicodeExtension is never called when the language tag is a grandfathered or private-use only tag.
  • Loading branch information
anba committed Sep 24, 2018
1 parent 211bf59 commit e9155f3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ <h1>ApplyUnicodeExtensionToTag( _tag_, _options_, _relevantExtensionKeys_ )</h1>
1. Let _locale_ be the String value that is _tag_ with all Unicode locale extension sequences removed.
1. Let _newExtension_ be the canonicalized Unicode BCP 47 U Extension based on _attributes_ and _keywords_ as defined in <a href="https://www.unicode.org/reports/tr35/#u_Extension">UTS #35 section 3.6</a>.
1. If _newExtension_ is not the empty String, then
1. Let _locale_ be ? InsertUnicodeExtension(_locale_, _newExtension_).
1. Let _locale_ be InsertUnicodeExtension(_locale_, _newExtension_).
1. Set _result_.[[locale]] to _locale_.
1. Return _result_.
</emu-alg>
Expand Down Expand Up @@ -161,9 +161,9 @@ <h1>InsertUnicodeExtension( _locale_, _extension_ )</h1>
</p>

<emu-alg>
1. Assert: _locale_ matches neither the `privateuse` nor the `grandfathered` production.
1. Assert: _locale_ does not contain a substring that is a Unicode locale extension sequence.
1. Assert: _extension_ is a Unicode extension sequence.
1. If _locale_ matches the `privateuse` or the `grandfathered` production, throw a *RangeError* exception.
1. Let _privateIndex_ be ! Call(%StringProto_indexOf%, _locale_, &laquo; `"-x-"` &raquo;).
1. If _privateIndex_ = -1, then
1. Let _locale_ be the concatenation of _locale_ and _extension_.
Expand Down

0 comments on commit e9155f3

Please sign in to comment.