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

Unified Diff: src/i18n.js

Issue 1096763003: Small polishing changes to the native js. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/macros.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/i18n.js
diff --git a/src/i18n.js b/src/i18n.js
index c743cad95a0e4ded70a1dd164a3a118080322cb8..e5dc8d2c370a1cc7843ffd13ca3719450e386890 100644
--- a/src/i18n.js
+++ b/src/i18n.js
@@ -14,7 +14,9 @@
%CheckIsBootstrapping();
+var GlobalBoolean = global.Boolean;
var GlobalDate = global.Date;
+var GlobalNumber = global.Number;
var GlobalRegExp = global.RegExp;
var GlobalString = global.String;
@@ -374,13 +376,13 @@ function getGetOption(options, caller) {
var value = options[property];
switch (type) {
case 'boolean':
- value = $Boolean(value);
+ value = GlobalBoolean(value);
break;
case 'string':
value = GlobalString(value);
break;
case 'number':
- value = $Number(value);
+ value = GlobalNumber(value);
break;
default:
throw new $Error('Internal error. Wrong value type.');
@@ -1056,7 +1058,7 @@ function isWellFormedCurrencyCode(currency) {
function getNumberOption(options, property, min, max, fallback) {
var value = options[property];
if (value !== undefined) {
- value = $Number(value);
+ value = GlobalNumber(value);
if ($isNaN(value) || value < min || value > max) {
throw new $RangeError(property + ' value is out of range.');
}
@@ -1272,7 +1274,7 @@ function initializeNumberFormat(numberFormat, locales, options) {
*/
function formatNumber(formatter, value) {
// Spec treats -0 and +0 as 0.
- var number = $Number(value) + 0;
+ var number = GlobalNumber(value) + 0;
return %InternalNumberFormat(%GetImplFromInitializedIntlObject(formatter),
number);
@@ -1668,7 +1670,7 @@ function formatDate(formatter, dateValue) {
if (dateValue === undefined) {
dateMs = GlobalDate.now();
} else {
- dateMs = $Number(dateValue);
+ dateMs = GlobalNumber(dateValue);
}
if (!$isFinite(dateMs)) {
@@ -1980,12 +1982,12 @@ OverrideFunction(GlobalString.prototype, 'normalize', function(that) {
* Formats a Number object (this) using locale and options values.
* If locale or options are omitted, defaults are used.
*/
-OverrideFunction($Number.prototype, 'toLocaleString', function() {
+OverrideFunction(GlobalNumber.prototype, 'toLocaleString', function() {
if (%_IsConstructCall()) {
throw new $TypeError(ORDINARY_FUNCTION_CALLED_AS_CONSTRUCTOR);
}
- if (!(this instanceof $Number) && typeof(this) !== 'number') {
+ if (!(this instanceof GlobalNumber) && typeof(this) !== 'number') {
throw new $TypeError('Method invoked on an object that is not Number.');
}
« no previous file with comments | « no previous file | src/macros.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698