Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(185)

Side by Side Diff: src/i18n.js

Issue 1282013002: [es6] Add appropriate ToString call to String.prototype.normalize (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/string.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 // ECMAScript 402 API implementation. 5 // ECMAScript 402 API implementation.
6 6
7 /** 7 /**
8 * Intl object is a single object that has some named properties, 8 * Intl object is a single object that has some named properties,
9 * all of which are constructors. 9 * all of which are constructors.
10 */ 10 */
(...skipping 1984 matching lines...) Expand 10 before | Expand all | Expand 10 after
1995 * If the form is not one of "NFC", "NFD", "NFKC", or "NFKD", then throw 1995 * If the form is not one of "NFC", "NFD", "NFKC", or "NFKD", then throw
1996 * a RangeError Exception. 1996 * a RangeError Exception.
1997 */ 1997 */
1998 1998
1999 OverrideFunction(GlobalString.prototype, 'normalize', function() { 1999 OverrideFunction(GlobalString.prototype, 'normalize', function() {
2000 if (%_IsConstructCall()) { 2000 if (%_IsConstructCall()) {
2001 throw MakeTypeError(kOrdinaryFunctionCalledAsConstructor); 2001 throw MakeTypeError(kOrdinaryFunctionCalledAsConstructor);
2002 } 2002 }
2003 2003
2004 CHECK_OBJECT_COERCIBLE(this, "String.prototype.normalize"); 2004 CHECK_OBJECT_COERCIBLE(this, "String.prototype.normalize");
2005 var s = TO_STRING_INLINE(this);
2005 2006
2006 var formArg = %_Arguments(0); 2007 var formArg = %_Arguments(0);
2007 var form = IS_UNDEFINED(formArg) ? 'NFC' : TO_STRING_INLINE(formArg); 2008 var form = IS_UNDEFINED(formArg) ? 'NFC' : TO_STRING_INLINE(formArg);
2008 2009
2009 var NORMALIZATION_FORMS = ['NFC', 'NFD', 'NFKC', 'NFKD']; 2010 var NORMALIZATION_FORMS = ['NFC', 'NFD', 'NFKC', 'NFKD'];
2010 2011
2011 var normalizationForm = 2012 var normalizationForm =
2012 %_CallFunction(NORMALIZATION_FORMS, form, ArrayIndexOf); 2013 %_CallFunction(NORMALIZATION_FORMS, form, ArrayIndexOf);
2013 if (normalizationForm === -1) { 2014 if (normalizationForm === -1) {
2014 throw MakeRangeError(kNormalizationForm, 2015 throw MakeRangeError(kNormalizationForm,
2015 %_CallFunction(NORMALIZATION_FORMS, ', ', ArrayJoin)); 2016 %_CallFunction(NORMALIZATION_FORMS, ', ', ArrayJoin));
2016 } 2017 }
2017 2018
2018 return %StringNormalize(this, normalizationForm); 2019 return %StringNormalize(s, normalizationForm);
2019 } 2020 }
2020 ); 2021 );
2021 2022
2022 2023
2023 /** 2024 /**
2024 * Formats a Number object (this) using locale and options values. 2025 * Formats a Number object (this) using locale and options values.
2025 * If locale or options are omitted, defaults are used. 2026 * If locale or options are omitted, defaults are used.
2026 */ 2027 */
2027 OverrideFunction(GlobalNumber.prototype, 'toLocaleString', function() { 2028 OverrideFunction(GlobalNumber.prototype, 'toLocaleString', function() {
2028 if (%_IsConstructCall()) { 2029 if (%_IsConstructCall()) {
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
2107 } 2108 }
2108 2109
2109 var locales = %_Arguments(0); 2110 var locales = %_Arguments(0);
2110 var options = %_Arguments(1); 2111 var options = %_Arguments(1);
2111 return toLocaleDateTime( 2112 return toLocaleDateTime(
2112 this, locales, options, 'time', 'time', 'dateformattime'); 2113 this, locales, options, 'time', 'time', 'dateformattime');
2113 } 2114 }
2114 ); 2115 );
2115 2116
2116 }) 2117 })
OLDNEW
« no previous file with comments | « no previous file | src/string.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698