| OLD | NEW |
| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 IsNaN = from.IsNaN; | 47 IsNaN = from.IsNaN; |
| 48 MathFloor = from.MathFloor; | 48 MathFloor = from.MathFloor; |
| 49 RegExpTest = from.RegExpTest; | 49 RegExpTest = from.RegExpTest; |
| 50 StringIndexOf = from.StringIndexOf; | 50 StringIndexOf = from.StringIndexOf; |
| 51 StringLastIndexOf = from.StringLastIndexOf; | 51 StringLastIndexOf = from.StringLastIndexOf; |
| 52 StringMatch = from.StringMatch; | 52 StringMatch = from.StringMatch; |
| 53 StringReplace = from.StringReplace; | 53 StringReplace = from.StringReplace; |
| 54 StringSplit = from.StringSplit; | 54 StringSplit = from.StringSplit; |
| 55 StringSubstr = from.StringSubstr; | 55 StringSubstr = from.StringSubstr; |
| 56 StringSubstring = from.StringSubstring; | 56 StringSubstring = from.StringSubstring; |
| 57 ToNumber = from.ToNumber; | |
| 58 }); | 57 }); |
| 59 | 58 |
| 60 // ------------------------------------------------------------------- | 59 // ------------------------------------------------------------------- |
| 61 | 60 |
| 62 var Intl = {}; | 61 var Intl = {}; |
| 63 | 62 |
| 64 %AddNamedProperty(global, "Intl", Intl, DONT_ENUM); | 63 %AddNamedProperty(global, "Intl", Intl, DONT_ENUM); |
| 65 | 64 |
| 66 /** | 65 /** |
| 67 * Caches available locales for each service. | 66 * Caches available locales for each service. |
| (...skipping 1203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1271 %SetNativeFlag(Intl.NumberFormat.supportedLocalesOf); | 1270 %SetNativeFlag(Intl.NumberFormat.supportedLocalesOf); |
| 1272 | 1271 |
| 1273 | 1272 |
| 1274 /** | 1273 /** |
| 1275 * Returns a String value representing the result of calling ToNumber(value) | 1274 * Returns a String value representing the result of calling ToNumber(value) |
| 1276 * according to the effective locale and the formatting options of this | 1275 * according to the effective locale and the formatting options of this |
| 1277 * NumberFormat. | 1276 * NumberFormat. |
| 1278 */ | 1277 */ |
| 1279 function formatNumber(formatter, value) { | 1278 function formatNumber(formatter, value) { |
| 1280 // Spec treats -0 and +0 as 0. | 1279 // Spec treats -0 and +0 as 0. |
| 1281 var number = ToNumber(value) + 0; | 1280 var number = TO_NUMBER(value) + 0; |
| 1282 | 1281 |
| 1283 return %InternalNumberFormat(%GetImplFromInitializedIntlObject(formatter), | 1282 return %InternalNumberFormat(%GetImplFromInitializedIntlObject(formatter), |
| 1284 number); | 1283 number); |
| 1285 } | 1284 } |
| 1286 | 1285 |
| 1287 | 1286 |
| 1288 /** | 1287 /** |
| 1289 * Returns a Number that represents string value that was passed in. | 1288 * Returns a Number that represents string value that was passed in. |
| 1290 */ | 1289 */ |
| 1291 function parseNumber(formatter, value) { | 1290 function parseNumber(formatter, value) { |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1696 /** | 1695 /** |
| 1697 * Returns a String value representing the result of calling ToNumber(date) | 1696 * Returns a String value representing the result of calling ToNumber(date) |
| 1698 * according to the effective locale and the formatting options of this | 1697 * according to the effective locale and the formatting options of this |
| 1699 * DateTimeFormat. | 1698 * DateTimeFormat. |
| 1700 */ | 1699 */ |
| 1701 function formatDate(formatter, dateValue) { | 1700 function formatDate(formatter, dateValue) { |
| 1702 var dateMs; | 1701 var dateMs; |
| 1703 if (IS_UNDEFINED(dateValue)) { | 1702 if (IS_UNDEFINED(dateValue)) { |
| 1704 dateMs = %DateCurrentTime(); | 1703 dateMs = %DateCurrentTime(); |
| 1705 } else { | 1704 } else { |
| 1706 dateMs = ToNumber(dateValue); | 1705 dateMs = TO_NUMBER(dateValue); |
| 1707 } | 1706 } |
| 1708 | 1707 |
| 1709 if (!IsFinite(dateMs)) throw MakeRangeError(kDateRange); | 1708 if (!IsFinite(dateMs)) throw MakeRangeError(kDateRange); |
| 1710 | 1709 |
| 1711 return %InternalDateFormat(%GetImplFromInitializedIntlObject(formatter), | 1710 return %InternalDateFormat(%GetImplFromInitializedIntlObject(formatter), |
| 1712 new GlobalDate(dateMs)); | 1711 new GlobalDate(dateMs)); |
| 1713 } | 1712 } |
| 1714 | 1713 |
| 1715 | 1714 |
| 1716 /** | 1715 /** |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2110 } | 2109 } |
| 2111 | 2110 |
| 2112 var locales = %_Arguments(0); | 2111 var locales = %_Arguments(0); |
| 2113 var options = %_Arguments(1); | 2112 var options = %_Arguments(1); |
| 2114 return toLocaleDateTime( | 2113 return toLocaleDateTime( |
| 2115 this, locales, options, 'time', 'time', 'dateformattime'); | 2114 this, locales, options, 'time', 'time', 'dateformattime'); |
| 2116 } | 2115 } |
| 2117 ); | 2116 ); |
| 2118 | 2117 |
| 2119 }) | 2118 }) |
| OLD | NEW |