| OLD | NEW |
| 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 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 return implementation(that, x); | 251 return implementation(that, x); |
| 252 } | 252 } |
| 253 } else { | 253 } else { |
| 254 boundMethod = function() { | 254 boundMethod = function() { |
| 255 if (%_IsConstructCall()) { | 255 if (%_IsConstructCall()) { |
| 256 throw new $TypeError(ORDINARY_FUNCTION_CALLED_AS_CONSTRUCTOR); | 256 throw new $TypeError(ORDINARY_FUNCTION_CALLED_AS_CONSTRUCTOR); |
| 257 } | 257 } |
| 258 // DateTimeFormat.format needs to be 0 arg method, but can stil | 258 // DateTimeFormat.format needs to be 0 arg method, but can stil |
| 259 // receive optional dateValue param. If one was provided, pass it | 259 // receive optional dateValue param. If one was provided, pass it |
| 260 // along. | 260 // along. |
| 261 if (arguments.length > 0) { | 261 if (%_ArgumentsLength() > 0) { |
| 262 return implementation(that, arguments[0]); | 262 return implementation(that, %_Arguments(0)); |
| 263 } else { | 263 } else { |
| 264 return implementation(that); | 264 return implementation(that); |
| 265 } | 265 } |
| 266 } | 266 } |
| 267 } | 267 } |
| 268 %FunctionSetName(boundMethod, internalName); | 268 %FunctionSetName(boundMethod, internalName); |
| 269 %FunctionRemovePrototype(boundMethod); | 269 %FunctionRemovePrototype(boundMethod); |
| 270 %SetNativeFlag(boundMethod); | 270 %SetNativeFlag(boundMethod); |
| 271 this[internalName] = boundMethod; | 271 this[internalName] = boundMethod; |
| 272 } | 272 } |
| (...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 971 } | 971 } |
| 972 | 972 |
| 973 | 973 |
| 974 /** | 974 /** |
| 975 * Constructs Intl.Collator object given optional locales and options | 975 * Constructs Intl.Collator object given optional locales and options |
| 976 * parameters. | 976 * parameters. |
| 977 * | 977 * |
| 978 * @constructor | 978 * @constructor |
| 979 */ | 979 */ |
| 980 %SetProperty(Intl, 'Collator', function() { | 980 %SetProperty(Intl, 'Collator', function() { |
| 981 var locales = arguments[0]; | 981 var locales = %_Arguments(0); |
| 982 var options = arguments[1]; | 982 var options = %_Arguments(1); |
| 983 | 983 |
| 984 if (!this || this === Intl) { | 984 if (!this || this === Intl) { |
| 985 // Constructor is called as a function. | 985 // Constructor is called as a function. |
| 986 return new Intl.Collator(locales, options); | 986 return new Intl.Collator(locales, options); |
| 987 } | 987 } |
| 988 | 988 |
| 989 return initializeCollator(toObject(this), locales, options); | 989 return initializeCollator(toObject(this), locales, options); |
| 990 }, | 990 }, |
| 991 DONT_ENUM | 991 DONT_ENUM |
| 992 ); | 992 ); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1031 * Returns the subset of the given locale list for which this locale list | 1031 * Returns the subset of the given locale list for which this locale list |
| 1032 * has a matching (possibly fallback) locale. Locales appear in the same | 1032 * has a matching (possibly fallback) locale. Locales appear in the same |
| 1033 * order in the returned list as in the input list. | 1033 * order in the returned list as in the input list. |
| 1034 * Options are optional parameter. | 1034 * Options are optional parameter. |
| 1035 */ | 1035 */ |
| 1036 %SetProperty(Intl.Collator, 'supportedLocalesOf', function(locales) { | 1036 %SetProperty(Intl.Collator, 'supportedLocalesOf', function(locales) { |
| 1037 if (%_IsConstructCall()) { | 1037 if (%_IsConstructCall()) { |
| 1038 throw new $TypeError(ORDINARY_FUNCTION_CALLED_AS_CONSTRUCTOR); | 1038 throw new $TypeError(ORDINARY_FUNCTION_CALLED_AS_CONSTRUCTOR); |
| 1039 } | 1039 } |
| 1040 | 1040 |
| 1041 return supportedLocalesOf('collator', locales, arguments[1]); | 1041 return supportedLocalesOf('collator', locales, %_Arguments(1)); |
| 1042 }, | 1042 }, |
| 1043 DONT_ENUM | 1043 DONT_ENUM |
| 1044 ); | 1044 ); |
| 1045 %FunctionSetName(Intl.Collator.supportedLocalesOf, 'supportedLocalesOf'); | 1045 %FunctionSetName(Intl.Collator.supportedLocalesOf, 'supportedLocalesOf'); |
| 1046 %FunctionRemovePrototype(Intl.Collator.supportedLocalesOf); | 1046 %FunctionRemovePrototype(Intl.Collator.supportedLocalesOf); |
| 1047 %SetNativeFlag(Intl.Collator.supportedLocalesOf); | 1047 %SetNativeFlag(Intl.Collator.supportedLocalesOf); |
| 1048 | 1048 |
| 1049 | 1049 |
| 1050 /** | 1050 /** |
| 1051 * When the compare method is called with two arguments x and y, it returns a | 1051 * When the compare method is called with two arguments x and y, it returns a |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1200 } | 1200 } |
| 1201 | 1201 |
| 1202 | 1202 |
| 1203 /** | 1203 /** |
| 1204 * Constructs Intl.NumberFormat object given optional locales and options | 1204 * Constructs Intl.NumberFormat object given optional locales and options |
| 1205 * parameters. | 1205 * parameters. |
| 1206 * | 1206 * |
| 1207 * @constructor | 1207 * @constructor |
| 1208 */ | 1208 */ |
| 1209 %SetProperty(Intl, 'NumberFormat', function() { | 1209 %SetProperty(Intl, 'NumberFormat', function() { |
| 1210 var locales = arguments[0]; | 1210 var locales = %_Arguments(0); |
| 1211 var options = arguments[1]; | 1211 var options = %_Arguments(1); |
| 1212 | 1212 |
| 1213 if (!this || this === Intl) { | 1213 if (!this || this === Intl) { |
| 1214 // Constructor is called as a function. | 1214 // Constructor is called as a function. |
| 1215 return new Intl.NumberFormat(locales, options); | 1215 return new Intl.NumberFormat(locales, options); |
| 1216 } | 1216 } |
| 1217 | 1217 |
| 1218 return initializeNumberFormat(toObject(this), locales, options); | 1218 return initializeNumberFormat(toObject(this), locales, options); |
| 1219 }, | 1219 }, |
| 1220 DONT_ENUM | 1220 DONT_ENUM |
| 1221 ); | 1221 ); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1279 * Returns the subset of the given locale list for which this locale list | 1279 * Returns the subset of the given locale list for which this locale list |
| 1280 * has a matching (possibly fallback) locale. Locales appear in the same | 1280 * has a matching (possibly fallback) locale. Locales appear in the same |
| 1281 * order in the returned list as in the input list. | 1281 * order in the returned list as in the input list. |
| 1282 * Options are optional parameter. | 1282 * Options are optional parameter. |
| 1283 */ | 1283 */ |
| 1284 %SetProperty(Intl.NumberFormat, 'supportedLocalesOf', function(locales) { | 1284 %SetProperty(Intl.NumberFormat, 'supportedLocalesOf', function(locales) { |
| 1285 if (%_IsConstructCall()) { | 1285 if (%_IsConstructCall()) { |
| 1286 throw new $TypeError(ORDINARY_FUNCTION_CALLED_AS_CONSTRUCTOR); | 1286 throw new $TypeError(ORDINARY_FUNCTION_CALLED_AS_CONSTRUCTOR); |
| 1287 } | 1287 } |
| 1288 | 1288 |
| 1289 return supportedLocalesOf('numberformat', locales, arguments[1]); | 1289 return supportedLocalesOf('numberformat', locales, %_Arguments(1)); |
| 1290 }, | 1290 }, |
| 1291 DONT_ENUM | 1291 DONT_ENUM |
| 1292 ); | 1292 ); |
| 1293 %FunctionSetName(Intl.NumberFormat.supportedLocalesOf, 'supportedLocalesOf'); | 1293 %FunctionSetName(Intl.NumberFormat.supportedLocalesOf, 'supportedLocalesOf'); |
| 1294 %FunctionRemovePrototype(Intl.NumberFormat.supportedLocalesOf); | 1294 %FunctionRemovePrototype(Intl.NumberFormat.supportedLocalesOf); |
| 1295 %SetNativeFlag(Intl.NumberFormat.supportedLocalesOf); | 1295 %SetNativeFlag(Intl.NumberFormat.supportedLocalesOf); |
| 1296 | 1296 |
| 1297 | 1297 |
| 1298 /** | 1298 /** |
| 1299 * Returns a String value representing the result of calling ToNumber(value) | 1299 * Returns a String value representing the result of calling ToNumber(value) |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1599 } | 1599 } |
| 1600 | 1600 |
| 1601 | 1601 |
| 1602 /** | 1602 /** |
| 1603 * Constructs Intl.DateTimeFormat object given optional locales and options | 1603 * Constructs Intl.DateTimeFormat object given optional locales and options |
| 1604 * parameters. | 1604 * parameters. |
| 1605 * | 1605 * |
| 1606 * @constructor | 1606 * @constructor |
| 1607 */ | 1607 */ |
| 1608 %SetProperty(Intl, 'DateTimeFormat', function() { | 1608 %SetProperty(Intl, 'DateTimeFormat', function() { |
| 1609 var locales = arguments[0]; | 1609 var locales = %_Arguments(0); |
| 1610 var options = arguments[1]; | 1610 var options = %_Arguments(1); |
| 1611 | 1611 |
| 1612 if (!this || this === Intl) { | 1612 if (!this || this === Intl) { |
| 1613 // Constructor is called as a function. | 1613 // Constructor is called as a function. |
| 1614 return new Intl.DateTimeFormat(locales, options); | 1614 return new Intl.DateTimeFormat(locales, options); |
| 1615 } | 1615 } |
| 1616 | 1616 |
| 1617 return initializeDateTimeFormat(toObject(this), locales, options); | 1617 return initializeDateTimeFormat(toObject(this), locales, options); |
| 1618 }, | 1618 }, |
| 1619 DONT_ENUM | 1619 DONT_ENUM |
| 1620 ); | 1620 ); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1678 * Returns the subset of the given locale list for which this locale list | 1678 * Returns the subset of the given locale list for which this locale list |
| 1679 * has a matching (possibly fallback) locale. Locales appear in the same | 1679 * has a matching (possibly fallback) locale. Locales appear in the same |
| 1680 * order in the returned list as in the input list. | 1680 * order in the returned list as in the input list. |
| 1681 * Options are optional parameter. | 1681 * Options are optional parameter. |
| 1682 */ | 1682 */ |
| 1683 %SetProperty(Intl.DateTimeFormat, 'supportedLocalesOf', function(locales) { | 1683 %SetProperty(Intl.DateTimeFormat, 'supportedLocalesOf', function(locales) { |
| 1684 if (%_IsConstructCall()) { | 1684 if (%_IsConstructCall()) { |
| 1685 throw new $TypeError(ORDINARY_FUNCTION_CALLED_AS_CONSTRUCTOR); | 1685 throw new $TypeError(ORDINARY_FUNCTION_CALLED_AS_CONSTRUCTOR); |
| 1686 } | 1686 } |
| 1687 | 1687 |
| 1688 return supportedLocalesOf('dateformat', locales, arguments[1]); | 1688 return supportedLocalesOf('dateformat', locales, %_Arguments(1)); |
| 1689 }, | 1689 }, |
| 1690 DONT_ENUM | 1690 DONT_ENUM |
| 1691 ); | 1691 ); |
| 1692 %FunctionSetName(Intl.DateTimeFormat.supportedLocalesOf, 'supportedLocalesOf'); | 1692 %FunctionSetName(Intl.DateTimeFormat.supportedLocalesOf, 'supportedLocalesOf'); |
| 1693 %FunctionRemovePrototype(Intl.DateTimeFormat.supportedLocalesOf); | 1693 %FunctionRemovePrototype(Intl.DateTimeFormat.supportedLocalesOf); |
| 1694 %SetNativeFlag(Intl.DateTimeFormat.supportedLocalesOf); | 1694 %SetNativeFlag(Intl.DateTimeFormat.supportedLocalesOf); |
| 1695 | 1695 |
| 1696 | 1696 |
| 1697 /** | 1697 /** |
| 1698 * Returns a String value representing the result of calling ToNumber(date) | 1698 * Returns a String value representing the result of calling ToNumber(date) |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1805 } | 1805 } |
| 1806 | 1806 |
| 1807 | 1807 |
| 1808 /** | 1808 /** |
| 1809 * Constructs Intl.v8BreakIterator object given optional locales and options | 1809 * Constructs Intl.v8BreakIterator object given optional locales and options |
| 1810 * parameters. | 1810 * parameters. |
| 1811 * | 1811 * |
| 1812 * @constructor | 1812 * @constructor |
| 1813 */ | 1813 */ |
| 1814 %SetProperty(Intl, 'v8BreakIterator', function() { | 1814 %SetProperty(Intl, 'v8BreakIterator', function() { |
| 1815 var locales = arguments[0]; | 1815 var locales = %_Arguments(0); |
| 1816 var options = arguments[1]; | 1816 var options = %_Arguments(1); |
| 1817 | 1817 |
| 1818 if (!this || this === Intl) { | 1818 if (!this || this === Intl) { |
| 1819 // Constructor is called as a function. | 1819 // Constructor is called as a function. |
| 1820 return new Intl.v8BreakIterator(locales, options); | 1820 return new Intl.v8BreakIterator(locales, options); |
| 1821 } | 1821 } |
| 1822 | 1822 |
| 1823 return initializeBreakIterator(toObject(this), locales, options); | 1823 return initializeBreakIterator(toObject(this), locales, options); |
| 1824 }, | 1824 }, |
| 1825 DONT_ENUM | 1825 DONT_ENUM |
| 1826 ); | 1826 ); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1861 * Returns the subset of the given locale list for which this locale list | 1861 * Returns the subset of the given locale list for which this locale list |
| 1862 * has a matching (possibly fallback) locale. Locales appear in the same | 1862 * has a matching (possibly fallback) locale. Locales appear in the same |
| 1863 * order in the returned list as in the input list. | 1863 * order in the returned list as in the input list. |
| 1864 * Options are optional parameter. | 1864 * Options are optional parameter. |
| 1865 */ | 1865 */ |
| 1866 %SetProperty(Intl.v8BreakIterator, 'supportedLocalesOf', function(locales) { | 1866 %SetProperty(Intl.v8BreakIterator, 'supportedLocalesOf', function(locales) { |
| 1867 if (%_IsConstructCall()) { | 1867 if (%_IsConstructCall()) { |
| 1868 throw new $TypeError(ORDINARY_FUNCTION_CALLED_AS_CONSTRUCTOR); | 1868 throw new $TypeError(ORDINARY_FUNCTION_CALLED_AS_CONSTRUCTOR); |
| 1869 } | 1869 } |
| 1870 | 1870 |
| 1871 return supportedLocalesOf('breakiterator', locales, arguments[1]); | 1871 return supportedLocalesOf('breakiterator', locales, %_Arguments(1)); |
| 1872 }, | 1872 }, |
| 1873 DONT_ENUM | 1873 DONT_ENUM |
| 1874 ); | 1874 ); |
| 1875 %FunctionSetName(Intl.v8BreakIterator.supportedLocalesOf, 'supportedLocalesOf'); | 1875 %FunctionSetName(Intl.v8BreakIterator.supportedLocalesOf, 'supportedLocalesOf'); |
| 1876 %FunctionRemovePrototype(Intl.v8BreakIterator.supportedLocalesOf); | 1876 %FunctionRemovePrototype(Intl.v8BreakIterator.supportedLocalesOf); |
| 1877 %SetNativeFlag(Intl.v8BreakIterator.supportedLocalesOf); | 1877 %SetNativeFlag(Intl.v8BreakIterator.supportedLocalesOf); |
| 1878 | 1878 |
| 1879 | 1879 |
| 1880 /** | 1880 /** |
| 1881 * Adopts text to segment using the iterator. Old text, if present, | 1881 * Adopts text to segment using the iterator. Old text, if present, |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1968 $Object.defineProperty($String.prototype, 'localeCompare', { | 1968 $Object.defineProperty($String.prototype, 'localeCompare', { |
| 1969 value: function(that) { | 1969 value: function(that) { |
| 1970 if (%_IsConstructCall()) { | 1970 if (%_IsConstructCall()) { |
| 1971 throw new $TypeError(ORDINARY_FUNCTION_CALLED_AS_CONSTRUCTOR); | 1971 throw new $TypeError(ORDINARY_FUNCTION_CALLED_AS_CONSTRUCTOR); |
| 1972 } | 1972 } |
| 1973 | 1973 |
| 1974 if (this === undefined || this === null) { | 1974 if (this === undefined || this === null) { |
| 1975 throw new $TypeError('Method invoked on undefined or null value.'); | 1975 throw new $TypeError('Method invoked on undefined or null value.'); |
| 1976 } | 1976 } |
| 1977 | 1977 |
| 1978 var locales = arguments[1]; | 1978 var locales = %_Arguments(1); |
| 1979 var options = arguments[2]; | 1979 var options = %_Arguments(2); |
| 1980 var collator = cachedOrNewService('collator', locales, options); | 1980 var collator = cachedOrNewService('collator', locales, options); |
| 1981 return compare(collator, this, that); | 1981 return compare(collator, this, that); |
| 1982 }, | 1982 }, |
| 1983 writable: true, | 1983 writable: true, |
| 1984 configurable: true, | 1984 configurable: true, |
| 1985 enumerable: false | 1985 enumerable: false |
| 1986 }); | 1986 }); |
| 1987 %FunctionSetName($String.prototype.localeCompare, 'localeCompare'); | 1987 %FunctionSetName($String.prototype.localeCompare, 'localeCompare'); |
| 1988 %FunctionRemovePrototype($String.prototype.localeCompare); | 1988 %FunctionRemovePrototype($String.prototype.localeCompare); |
| 1989 %SetNativeFlag($String.prototype.localeCompare); | 1989 %SetNativeFlag($String.prototype.localeCompare); |
| 1990 | 1990 |
| 1991 | 1991 |
| 1992 /** | 1992 /** |
| 1993 * Formats a Number object (this) using locale and options values. | 1993 * Formats a Number object (this) using locale and options values. |
| 1994 * If locale or options are omitted, defaults are used. | 1994 * If locale or options are omitted, defaults are used. |
| 1995 */ | 1995 */ |
| 1996 $Object.defineProperty($Number.prototype, 'toLocaleString', { | 1996 $Object.defineProperty($Number.prototype, 'toLocaleString', { |
| 1997 value: function() { | 1997 value: function() { |
| 1998 if (%_IsConstructCall()) { | 1998 if (%_IsConstructCall()) { |
| 1999 throw new $TypeError(ORDINARY_FUNCTION_CALLED_AS_CONSTRUCTOR); | 1999 throw new $TypeError(ORDINARY_FUNCTION_CALLED_AS_CONSTRUCTOR); |
| 2000 } | 2000 } |
| 2001 | 2001 |
| 2002 if (!(this instanceof $Number) && typeof(this) !== 'number') { | 2002 if (!(this instanceof $Number) && typeof(this) !== 'number') { |
| 2003 throw new $TypeError('Method invoked on an object that is not Number.'); | 2003 throw new $TypeError('Method invoked on an object that is not Number.'); |
| 2004 } | 2004 } |
| 2005 | 2005 |
| 2006 var locales = arguments[0]; | 2006 var locales = %_Arguments(0); |
| 2007 var options = arguments[1]; | 2007 var options = %_Arguments(1); |
| 2008 var numberFormat = cachedOrNewService('numberformat', locales, options); | 2008 var numberFormat = cachedOrNewService('numberformat', locales, options); |
| 2009 return formatNumber(numberFormat, this); | 2009 return formatNumber(numberFormat, this); |
| 2010 }, | 2010 }, |
| 2011 writable: true, | 2011 writable: true, |
| 2012 configurable: true, | 2012 configurable: true, |
| 2013 enumerable: false | 2013 enumerable: false |
| 2014 }); | 2014 }); |
| 2015 %FunctionSetName($Number.prototype.toLocaleString, 'toLocaleString'); | 2015 %FunctionSetName($Number.prototype.toLocaleString, 'toLocaleString'); |
| 2016 %FunctionRemovePrototype($Number.prototype.toLocaleString); | 2016 %FunctionRemovePrototype($Number.prototype.toLocaleString); |
| 2017 %SetNativeFlag($Number.prototype.toLocaleString); | 2017 %SetNativeFlag($Number.prototype.toLocaleString); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 2042 * Formats a Date object (this) using locale and options values. | 2042 * Formats a Date object (this) using locale and options values. |
| 2043 * If locale or options are omitted, defaults are used - both date and time are | 2043 * If locale or options are omitted, defaults are used - both date and time are |
| 2044 * present in the output. | 2044 * present in the output. |
| 2045 */ | 2045 */ |
| 2046 $Object.defineProperty($Date.prototype, 'toLocaleString', { | 2046 $Object.defineProperty($Date.prototype, 'toLocaleString', { |
| 2047 value: function() { | 2047 value: function() { |
| 2048 if (%_IsConstructCall()) { | 2048 if (%_IsConstructCall()) { |
| 2049 throw new $TypeError(ORDINARY_FUNCTION_CALLED_AS_CONSTRUCTOR); | 2049 throw new $TypeError(ORDINARY_FUNCTION_CALLED_AS_CONSTRUCTOR); |
| 2050 } | 2050 } |
| 2051 | 2051 |
| 2052 var locales = arguments[0]; | 2052 var locales = %_Arguments(0); |
| 2053 var options = arguments[1]; | 2053 var options = %_Arguments(1); |
| 2054 return toLocaleDateTime( | 2054 return toLocaleDateTime( |
| 2055 this, locales, options, 'any', 'all', 'dateformatall'); | 2055 this, locales, options, 'any', 'all', 'dateformatall'); |
| 2056 }, | 2056 }, |
| 2057 writable: true, | 2057 writable: true, |
| 2058 configurable: true, | 2058 configurable: true, |
| 2059 enumerable: false | 2059 enumerable: false |
| 2060 }); | 2060 }); |
| 2061 %FunctionSetName($Date.prototype.toLocaleString, 'toLocaleString'); | 2061 %FunctionSetName($Date.prototype.toLocaleString, 'toLocaleString'); |
| 2062 %FunctionRemovePrototype($Date.prototype.toLocaleString); | 2062 %FunctionRemovePrototype($Date.prototype.toLocaleString); |
| 2063 %SetNativeFlag($Date.prototype.toLocaleString); | 2063 %SetNativeFlag($Date.prototype.toLocaleString); |
| 2064 | 2064 |
| 2065 | 2065 |
| 2066 /** | 2066 /** |
| 2067 * Formats a Date object (this) using locale and options values. | 2067 * Formats a Date object (this) using locale and options values. |
| 2068 * If locale or options are omitted, defaults are used - only date is present | 2068 * If locale or options are omitted, defaults are used - only date is present |
| 2069 * in the output. | 2069 * in the output. |
| 2070 */ | 2070 */ |
| 2071 $Object.defineProperty($Date.prototype, 'toLocaleDateString', { | 2071 $Object.defineProperty($Date.prototype, 'toLocaleDateString', { |
| 2072 value: function() { | 2072 value: function() { |
| 2073 if (%_IsConstructCall()) { | 2073 if (%_IsConstructCall()) { |
| 2074 throw new $TypeError(ORDINARY_FUNCTION_CALLED_AS_CONSTRUCTOR); | 2074 throw new $TypeError(ORDINARY_FUNCTION_CALLED_AS_CONSTRUCTOR); |
| 2075 } | 2075 } |
| 2076 | 2076 |
| 2077 var locales = arguments[0]; | 2077 var locales = %_Arguments(0); |
| 2078 var options = arguments[1]; | 2078 var options = %_Arguments(1); |
| 2079 return toLocaleDateTime( | 2079 return toLocaleDateTime( |
| 2080 this, locales, options, 'date', 'date', 'dateformatdate'); | 2080 this, locales, options, 'date', 'date', 'dateformatdate'); |
| 2081 }, | 2081 }, |
| 2082 writable: true, | 2082 writable: true, |
| 2083 configurable: true, | 2083 configurable: true, |
| 2084 enumerable: false | 2084 enumerable: false |
| 2085 }); | 2085 }); |
| 2086 %FunctionSetName($Date.prototype.toLocaleDateString, 'toLocaleDateString'); | 2086 %FunctionSetName($Date.prototype.toLocaleDateString, 'toLocaleDateString'); |
| 2087 %FunctionRemovePrototype($Date.prototype.toLocaleDateString); | 2087 %FunctionRemovePrototype($Date.prototype.toLocaleDateString); |
| 2088 %SetNativeFlag($Date.prototype.toLocaleDateString); | 2088 %SetNativeFlag($Date.prototype.toLocaleDateString); |
| 2089 | 2089 |
| 2090 | 2090 |
| 2091 /** | 2091 /** |
| 2092 * Formats a Date object (this) using locale and options values. | 2092 * Formats a Date object (this) using locale and options values. |
| 2093 * If locale or options are omitted, defaults are used - only time is present | 2093 * If locale or options are omitted, defaults are used - only time is present |
| 2094 * in the output. | 2094 * in the output. |
| 2095 */ | 2095 */ |
| 2096 $Object.defineProperty($Date.prototype, 'toLocaleTimeString', { | 2096 $Object.defineProperty($Date.prototype, 'toLocaleTimeString', { |
| 2097 value: function() { | 2097 value: function() { |
| 2098 if (%_IsConstructCall()) { | 2098 if (%_IsConstructCall()) { |
| 2099 throw new $TypeError(ORDINARY_FUNCTION_CALLED_AS_CONSTRUCTOR); | 2099 throw new $TypeError(ORDINARY_FUNCTION_CALLED_AS_CONSTRUCTOR); |
| 2100 } | 2100 } |
| 2101 | 2101 |
| 2102 var locales = arguments[0]; | 2102 var locales = %_Arguments(0); |
| 2103 var options = arguments[1]; | 2103 var options = %_Arguments(1); |
| 2104 return toLocaleDateTime( | 2104 return toLocaleDateTime( |
| 2105 this, locales, options, 'time', 'time', 'dateformattime'); | 2105 this, locales, options, 'time', 'time', 'dateformattime'); |
| 2106 }, | 2106 }, |
| 2107 writable: true, | 2107 writable: true, |
| 2108 configurable: true, | 2108 configurable: true, |
| 2109 enumerable: false | 2109 enumerable: false |
| 2110 }); | 2110 }); |
| 2111 %FunctionSetName($Date.prototype.toLocaleTimeString, 'toLocaleTimeString'); | 2111 %FunctionSetName($Date.prototype.toLocaleTimeString, 'toLocaleTimeString'); |
| 2112 %FunctionRemovePrototype($Date.prototype.toLocaleTimeString); | 2112 %FunctionRemovePrototype($Date.prototype.toLocaleTimeString); |
| 2113 %SetNativeFlag($Date.prototype.toLocaleTimeString); | 2113 %SetNativeFlag($Date.prototype.toLocaleTimeString); |
| 2114 | 2114 |
| 2115 return Intl; | 2115 return Intl; |
| 2116 }())}); | 2116 }())}); |
| OLD | NEW |