| 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 1729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1740 | 1740 |
| 1741 return %InternalDateFormat(%GetImplFromInitializedIntlObject(formatter), | 1741 return %InternalDateFormat(%GetImplFromInitializedIntlObject(formatter), |
| 1742 new GlobalDate(dateMs)); | 1742 new GlobalDate(dateMs)); |
| 1743 } | 1743 } |
| 1744 | 1744 |
| 1745 function FormatDateToParts(dateValue) { | 1745 function FormatDateToParts(dateValue) { |
| 1746 CHECK_OBJECT_COERCIBLE(this, "Intl.DateTimeFormat.prototype.formatToParts"); | 1746 CHECK_OBJECT_COERCIBLE(this, "Intl.DateTimeFormat.prototype.formatToParts"); |
| 1747 if (!IS_OBJECT(this)) { | 1747 if (!IS_OBJECT(this)) { |
| 1748 throw %make_type_error(kCalledOnNonObject, this); | 1748 throw %make_type_error(kCalledOnNonObject, this); |
| 1749 } | 1749 } |
| 1750 if (!%IsInitializedIntlObjectOfType(this, 'dateformat')) { |
| 1751 throw %make_type_error(kIncompatibleMethodReceiver, |
| 1752 'Intl.DateTimeFormat.prototype.formatToParts', |
| 1753 this); |
| 1754 } |
| 1750 var dateMs; | 1755 var dateMs; |
| 1751 if (IS_UNDEFINED(dateValue)) { | 1756 if (IS_UNDEFINED(dateValue)) { |
| 1752 dateMs = %DateCurrentTime(); | 1757 dateMs = %DateCurrentTime(); |
| 1753 } else { | 1758 } else { |
| 1754 dateMs = TO_NUMBER(dateValue); | 1759 dateMs = TO_NUMBER(dateValue); |
| 1755 } | 1760 } |
| 1756 | 1761 |
| 1757 if (!NUMBER_IS_FINITE(dateMs)) throw %make_range_error(kDateRange); | 1762 if (!NUMBER_IS_FINITE(dateMs)) throw %make_range_error(kDateRange); |
| 1758 | 1763 |
| 1759 return %InternalDateFormatToParts( | 1764 return %InternalDateFormatToParts( |
| (...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2197 } | 2202 } |
| 2198 ); | 2203 ); |
| 2199 | 2204 |
| 2200 %FunctionRemovePrototype(FormatDateToParts); | 2205 %FunctionRemovePrototype(FormatDateToParts); |
| 2201 | 2206 |
| 2202 utils.Export(function(to) { | 2207 utils.Export(function(to) { |
| 2203 to.FormatDateToParts = FormatDateToParts; | 2208 to.FormatDateToParts = FormatDateToParts; |
| 2204 }); | 2209 }); |
| 2205 | 2210 |
| 2206 }) | 2211 }) |
| OLD | NEW |