Reviewers: mvstanton,
Description:
Remove duplicate ToObject implementaion from i18n.
[email protected]
BUG=
Please review this at https://codereview.chromium.org/255273004/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files (+7, -19 lines):
M src/i18n.js
Index: src/i18n.js
diff --git a/src/i18n.js b/src/i18n.js
index
edfb065c9c998afd12ec059c04b30532289592bb..1f087dc41159c42a1f89b6d4070e360619a8b38e
100644
--- a/src/i18n.js
+++ b/src/i18n.js
@@ -302,7 +302,7 @@ function supportedLocalesOf(service, locales, options) {
if (options === undefined) {
options = {};
} else {
- options = toObject(options);
+ options = ToObject(options);
}
var matcher = options.localeMatcher;
@@ -536,18 +536,6 @@ function parseExtension(extension) {
/**
- * Converts parameter to an Object if possible.
- */
-function toObject(value) {
- if (IS_NULL_OR_UNDEFINED(value)) {
- throw new $TypeError('Value cannot be converted to an Object.');
- }
-
- return $Object(value);
-}
-
-
-/**
* Populates internalOptions object with boolean key-value pairs
* from extensionMap and options.
* Returns filtered extension (number and date format constructors use
@@ -776,7 +764,7 @@ function initializeLocaleList(locales) {
return freezeArray(seen);
}
- var o = toObject(locales);
+ var o = ToObject(locales);
// Converts it to UInt32 (>>> is shr on 32bit integers).
var len = o.length >>> 0;
@@ -988,7 +976,7 @@ function initializeCollator(collator, locales, options)
{
return new Intl.Collator(locales, options);
}
- return initializeCollator(toObject(this), locales, options);
+ return initializeCollator(ToObject(this), locales, options);
},
DONT_ENUM
);
@@ -1215,7 +1203,7 @@ function initializeNumberFormat(numberFormat,
locales, options) {
return new Intl.NumberFormat(locales, options);
}
- return initializeNumberFormat(toObject(this), locales, options);
+ return initializeNumberFormat(ToObject(this), locales, options);
},
DONT_ENUM
);
@@ -1468,7 +1456,7 @@ function toDateTimeOptions(options, required,
defaults) {
if (options === undefined) {
options = null;
} else {
- options = toObject(options);
+ options = ToObject(options);
}
options = $Object.apply(this, [options]);
@@ -1610,7 +1598,7 @@ function initializeDateTimeFormat(dateFormat,
locales, options) {
return new Intl.DateTimeFormat(locales, options);
}
- return initializeDateTimeFormat(toObject(this), locales, options);
+ return initializeDateTimeFormat(ToObject(this), locales, options);
},
DONT_ENUM
);
@@ -1816,7 +1804,7 @@ function initializeBreakIterator(iterator, locales,
options) {
return new Intl.v8BreakIterator(locales, options);
}
- return initializeBreakIterator(toObject(this), locales, options);
+ return initializeBreakIterator(ToObject(this), locales, options);
},
DONT_ENUM
);
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.