OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 var $stringCharAt; | 5 var $stringCharAt; |
6 var $stringIndexOf; | 6 var $stringIndexOf; |
7 var $stringSubstring; | 7 var $stringSubstring; |
8 | 8 |
9 (function() { | 9 (function() { |
10 | 10 |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 // | 172 // |
173 // For now we do nothing, as proper normalization requires big tables. | 173 // For now we do nothing, as proper normalization requires big tables. |
174 // If Intl is enabled, then i18n.js will override it and provide the the | 174 // If Intl is enabled, then i18n.js will override it and provide the the |
175 // proper functionality. | 175 // proper functionality. |
176 function StringNormalizeJS(form) { | 176 function StringNormalizeJS(form) { |
177 CHECK_OBJECT_COERCIBLE(this, "String.prototype.normalize"); | 177 CHECK_OBJECT_COERCIBLE(this, "String.prototype.normalize"); |
178 | 178 |
179 var form = form ? TO_STRING_INLINE(form) : 'NFC'; | 179 var form = form ? TO_STRING_INLINE(form) : 'NFC'; |
180 var normalizationForm = NORMALIZATION_FORMS.indexOf(form); | 180 var normalizationForm = NORMALIZATION_FORMS.indexOf(form); |
181 if (normalizationForm === -1) { | 181 if (normalizationForm === -1) { |
182 throw new $RangeError('The normalization form should be one of ' | 182 throw MakeRangeError(kNormalizationForm, NORMALIZATION_FORMS.join(', ')); |
183 + NORMALIZATION_FORMS.join(', ') + '.'); | |
184 } | 183 } |
185 | 184 |
186 return %_ValueOf(this); | 185 return %_ValueOf(this); |
187 } | 186 } |
188 | 187 |
189 | 188 |
190 // This has the same size as the $regexpLastMatchInfo array, and can be used | 189 // This has the same size as the $regexpLastMatchInfo array, and can be used |
191 // for functions that expect that structure to be returned. It is used when | 190 // for functions that expect that structure to be returned. It is used when |
192 // the needle is a string rather than a regexp. In this case we can't update | 191 // the needle is a string rather than a regexp. In this case we can't update |
193 // lastMatchArray without erroneously affecting the properties on the global | 192 // lastMatchArray without erroneously affecting the properties on the global |
(...skipping 980 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1174 "strike", StringStrike, | 1173 "strike", StringStrike, |
1175 "sub", StringSub, | 1174 "sub", StringSub, |
1176 "sup", StringSup | 1175 "sup", StringSup |
1177 ]); | 1176 ]); |
1178 | 1177 |
1179 $stringCharAt = StringCharAtJS; | 1178 $stringCharAt = StringCharAtJS; |
1180 $stringIndexOf = StringIndexOfJS; | 1179 $stringIndexOf = StringIndexOfJS; |
1181 $stringSubstring = StringSubstring; | 1180 $stringSubstring = StringSubstring; |
1182 | 1181 |
1183 })(); | 1182 })(); |
OLD | NEW |