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

Side by Side Diff: src/extensions/i18n/number-format.js

Issue 18075004: Mark i18n functions as native and set proper names (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « src/extensions/i18n/i18n-utils.js ('k') | src/extensions/i18n/overrides.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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 230
231 if (format.resolved.hasOwnProperty('maximumSignificantDigits')) { 231 if (format.resolved.hasOwnProperty('maximumSignificantDigits')) {
232 defineWECProperty(result, 'maximumSignificantDigits', 232 defineWECProperty(result, 'maximumSignificantDigits',
233 format.resolved.maximumSignificantDigits); 233 format.resolved.maximumSignificantDigits);
234 } 234 }
235 235
236 return result; 236 return result;
237 }, 237 },
238 ATTRIBUTES.DONT_ENUM 238 ATTRIBUTES.DONT_ENUM
239 ); 239 );
240 %FunctionSetName(Intl.NumberFormat.prototype.resolvedOptions,
241 'resolvedOptions');
240 %FunctionRemovePrototype(Intl.NumberFormat.prototype.resolvedOptions); 242 %FunctionRemovePrototype(Intl.NumberFormat.prototype.resolvedOptions);
243 %SetNativeFlag(Intl.NumberFormat.prototype.resolvedOptions);
241 244
242 245
243 /** 246 /**
244 * Returns the subset of the given locale list for which this locale list 247 * Returns the subset of the given locale list for which this locale list
245 * has a matching (possibly fallback) locale. Locales appear in the same 248 * has a matching (possibly fallback) locale. Locales appear in the same
246 * order in the returned list as in the input list. 249 * order in the returned list as in the input list.
247 * Options are optional parameter. 250 * Options are optional parameter.
248 */ 251 */
249 %SetProperty(Intl.NumberFormat, 'supportedLocalesOf', function(locales) { 252 %SetProperty(Intl.NumberFormat, 'supportedLocalesOf', function(locales) {
250 if (%_IsConstructCall()) { 253 if (%_IsConstructCall()) {
251 throw new TypeError(ORDINARY_FUNCTION_CALLED_AS_CONSTRUCTOR); 254 throw new TypeError(ORDINARY_FUNCTION_CALLED_AS_CONSTRUCTOR);
252 } 255 }
253 256
254 return supportedLocalesOf('numberformat', locales, arguments[1]); 257 return supportedLocalesOf('numberformat', locales, arguments[1]);
255 }, 258 },
256 ATTRIBUTES.DONT_ENUM 259 ATTRIBUTES.DONT_ENUM
257 ); 260 );
261 %FunctionSetName(Intl.NumberFormat.supportedLocalesOf, 'supportedLocalesOf');
258 %FunctionRemovePrototype(Intl.NumberFormat.supportedLocalesOf); 262 %FunctionRemovePrototype(Intl.NumberFormat.supportedLocalesOf);
263 %SetNativeFlag(Intl.NumberFormat.supportedLocalesOf);
259 264
260 265
261 /** 266 /**
262 * Returns a String value representing the result of calling ToNumber(value) 267 * Returns a String value representing the result of calling ToNumber(value)
263 * according to the effective locale and the formatting options of this 268 * according to the effective locale and the formatting options of this
264 * NumberFormat. 269 * NumberFormat.
265 */ 270 */
266 function formatNumber(formatter, value) { 271 function formatNumber(formatter, value) {
267 native function NativeJSInternalNumberFormat(); 272 native function NativeJSInternalNumberFormat();
268 273
(...skipping 12 matching lines...) Expand all
281 */ 286 */
282 function parseNumber(formatter, value) { 287 function parseNumber(formatter, value) {
283 native function NativeJSInternalNumberParse(); 288 native function NativeJSInternalNumberParse();
284 289
285 return NativeJSInternalNumberParse(formatter.formatter, String(value)); 290 return NativeJSInternalNumberParse(formatter.formatter, String(value));
286 } 291 }
287 292
288 293
289 addBoundMethod(Intl.NumberFormat, 'format', formatNumber, 1); 294 addBoundMethod(Intl.NumberFormat, 'format', formatNumber, 1);
290 addBoundMethod(Intl.NumberFormat, 'v8Parse', parseNumber, 1); 295 addBoundMethod(Intl.NumberFormat, 'v8Parse', parseNumber, 1);
OLDNEW
« no previous file with comments | « src/extensions/i18n/i18n-utils.js ('k') | src/extensions/i18n/overrides.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698