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

Side by Side Diff: src/i18n.js

Issue 351853005: Split SetProperty(...attributes, strictmode) into AddProperty(...attributes) and SetProperty(...… (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/generator.js ('k') | src/ia32/full-codegen-ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "use strict"; 5 "use strict";
6 6
7 // ECMAScript 402 API implementation. 7 // ECMAScript 402 API implementation.
8 8
9 /** 9 /**
10 * Intl object is a single object that has some named properties, 10 * Intl object is a single object that has some named properties,
(...skipping 924 matching lines...) Expand 10 before | Expand all | Expand 10 after
935 return collator; 935 return collator;
936 } 936 }
937 937
938 938
939 /** 939 /**
940 * Constructs Intl.Collator object given optional locales and options 940 * Constructs Intl.Collator object given optional locales and options
941 * parameters. 941 * parameters.
942 * 942 *
943 * @constructor 943 * @constructor
944 */ 944 */
945 %SetProperty(Intl, 'Collator', function() { 945 %AddProperty(Intl, 'Collator', function() {
946 var locales = %_Arguments(0); 946 var locales = %_Arguments(0);
947 var options = %_Arguments(1); 947 var options = %_Arguments(1);
948 948
949 if (!this || this === Intl) { 949 if (!this || this === Intl) {
950 // Constructor is called as a function. 950 // Constructor is called as a function.
951 return new Intl.Collator(locales, options); 951 return new Intl.Collator(locales, options);
952 } 952 }
953 953
954 return initializeCollator(ToObject(this), locales, options); 954 return initializeCollator(ToObject(this), locales, options);
955 }, 955 },
956 DONT_ENUM 956 DONT_ENUM
957 ); 957 );
958 958
959 959
960 /** 960 /**
961 * Collator resolvedOptions method. 961 * Collator resolvedOptions method.
962 */ 962 */
963 %SetProperty(Intl.Collator.prototype, 'resolvedOptions', function() { 963 %AddProperty(Intl.Collator.prototype, 'resolvedOptions', function() {
964 if (%_IsConstructCall()) { 964 if (%_IsConstructCall()) {
965 throw new $TypeError(ORDINARY_FUNCTION_CALLED_AS_CONSTRUCTOR); 965 throw new $TypeError(ORDINARY_FUNCTION_CALLED_AS_CONSTRUCTOR);
966 } 966 }
967 967
968 if (!%IsInitializedIntlObjectOfType(this, 'collator')) { 968 if (!%IsInitializedIntlObjectOfType(this, 'collator')) {
969 throw new $TypeError('resolvedOptions method called on a non-object ' + 969 throw new $TypeError('resolvedOptions method called on a non-object ' +
970 'or on a object that is not Intl.Collator.'); 970 'or on a object that is not Intl.Collator.');
971 } 971 }
972 972
973 var coll = this; 973 var coll = this;
(...skipping 16 matching lines...) Expand all
990 %FunctionRemovePrototype(Intl.Collator.prototype.resolvedOptions); 990 %FunctionRemovePrototype(Intl.Collator.prototype.resolvedOptions);
991 %SetNativeFlag(Intl.Collator.prototype.resolvedOptions); 991 %SetNativeFlag(Intl.Collator.prototype.resolvedOptions);
992 992
993 993
994 /** 994 /**
995 * Returns the subset of the given locale list for which this locale list 995 * Returns the subset of the given locale list for which this locale list
996 * has a matching (possibly fallback) locale. Locales appear in the same 996 * has a matching (possibly fallback) locale. Locales appear in the same
997 * order in the returned list as in the input list. 997 * order in the returned list as in the input list.
998 * Options are optional parameter. 998 * Options are optional parameter.
999 */ 999 */
1000 %SetProperty(Intl.Collator, 'supportedLocalesOf', function(locales) { 1000 %AddProperty(Intl.Collator, 'supportedLocalesOf', function(locales) {
1001 if (%_IsConstructCall()) { 1001 if (%_IsConstructCall()) {
1002 throw new $TypeError(ORDINARY_FUNCTION_CALLED_AS_CONSTRUCTOR); 1002 throw new $TypeError(ORDINARY_FUNCTION_CALLED_AS_CONSTRUCTOR);
1003 } 1003 }
1004 1004
1005 return supportedLocalesOf('collator', locales, %_Arguments(1)); 1005 return supportedLocalesOf('collator', locales, %_Arguments(1));
1006 }, 1006 },
1007 DONT_ENUM 1007 DONT_ENUM
1008 ); 1008 );
1009 %FunctionSetName(Intl.Collator.supportedLocalesOf, 'supportedLocalesOf'); 1009 %FunctionSetName(Intl.Collator.supportedLocalesOf, 'supportedLocalesOf');
1010 %FunctionRemovePrototype(Intl.Collator.supportedLocalesOf); 1010 %FunctionRemovePrototype(Intl.Collator.supportedLocalesOf);
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
1162 return numberFormat; 1162 return numberFormat;
1163 } 1163 }
1164 1164
1165 1165
1166 /** 1166 /**
1167 * Constructs Intl.NumberFormat object given optional locales and options 1167 * Constructs Intl.NumberFormat object given optional locales and options
1168 * parameters. 1168 * parameters.
1169 * 1169 *
1170 * @constructor 1170 * @constructor
1171 */ 1171 */
1172 %SetProperty(Intl, 'NumberFormat', function() { 1172 %AddProperty(Intl, 'NumberFormat', function() {
1173 var locales = %_Arguments(0); 1173 var locales = %_Arguments(0);
1174 var options = %_Arguments(1); 1174 var options = %_Arguments(1);
1175 1175
1176 if (!this || this === Intl) { 1176 if (!this || this === Intl) {
1177 // Constructor is called as a function. 1177 // Constructor is called as a function.
1178 return new Intl.NumberFormat(locales, options); 1178 return new Intl.NumberFormat(locales, options);
1179 } 1179 }
1180 1180
1181 return initializeNumberFormat(ToObject(this), locales, options); 1181 return initializeNumberFormat(ToObject(this), locales, options);
1182 }, 1182 },
1183 DONT_ENUM 1183 DONT_ENUM
1184 ); 1184 );
1185 1185
1186 1186
1187 /** 1187 /**
1188 * NumberFormat resolvedOptions method. 1188 * NumberFormat resolvedOptions method.
1189 */ 1189 */
1190 %SetProperty(Intl.NumberFormat.prototype, 'resolvedOptions', function() { 1190 %AddProperty(Intl.NumberFormat.prototype, 'resolvedOptions', function() {
1191 if (%_IsConstructCall()) { 1191 if (%_IsConstructCall()) {
1192 throw new $TypeError(ORDINARY_FUNCTION_CALLED_AS_CONSTRUCTOR); 1192 throw new $TypeError(ORDINARY_FUNCTION_CALLED_AS_CONSTRUCTOR);
1193 } 1193 }
1194 1194
1195 if (!%IsInitializedIntlObjectOfType(this, 'numberformat')) { 1195 if (!%IsInitializedIntlObjectOfType(this, 'numberformat')) {
1196 throw new $TypeError('resolvedOptions method called on a non-object' + 1196 throw new $TypeError('resolvedOptions method called on a non-object' +
1197 ' or on a object that is not Intl.NumberFormat.'); 1197 ' or on a object that is not Intl.NumberFormat.');
1198 } 1198 }
1199 1199
1200 var format = this; 1200 var format = this;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1236 %FunctionRemovePrototype(Intl.NumberFormat.prototype.resolvedOptions); 1236 %FunctionRemovePrototype(Intl.NumberFormat.prototype.resolvedOptions);
1237 %SetNativeFlag(Intl.NumberFormat.prototype.resolvedOptions); 1237 %SetNativeFlag(Intl.NumberFormat.prototype.resolvedOptions);
1238 1238
1239 1239
1240 /** 1240 /**
1241 * Returns the subset of the given locale list for which this locale list 1241 * Returns the subset of the given locale list for which this locale list
1242 * has a matching (possibly fallback) locale. Locales appear in the same 1242 * has a matching (possibly fallback) locale. Locales appear in the same
1243 * order in the returned list as in the input list. 1243 * order in the returned list as in the input list.
1244 * Options are optional parameter. 1244 * Options are optional parameter.
1245 */ 1245 */
1246 %SetProperty(Intl.NumberFormat, 'supportedLocalesOf', function(locales) { 1246 %AddProperty(Intl.NumberFormat, 'supportedLocalesOf', function(locales) {
1247 if (%_IsConstructCall()) { 1247 if (%_IsConstructCall()) {
1248 throw new $TypeError(ORDINARY_FUNCTION_CALLED_AS_CONSTRUCTOR); 1248 throw new $TypeError(ORDINARY_FUNCTION_CALLED_AS_CONSTRUCTOR);
1249 } 1249 }
1250 1250
1251 return supportedLocalesOf('numberformat', locales, %_Arguments(1)); 1251 return supportedLocalesOf('numberformat', locales, %_Arguments(1));
1252 }, 1252 },
1253 DONT_ENUM 1253 DONT_ENUM
1254 ); 1254 );
1255 %FunctionSetName(Intl.NumberFormat.supportedLocalesOf, 'supportedLocalesOf'); 1255 %FunctionSetName(Intl.NumberFormat.supportedLocalesOf, 'supportedLocalesOf');
1256 %FunctionRemovePrototype(Intl.NumberFormat.supportedLocalesOf); 1256 %FunctionRemovePrototype(Intl.NumberFormat.supportedLocalesOf);
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
1555 return dateFormat; 1555 return dateFormat;
1556 } 1556 }
1557 1557
1558 1558
1559 /** 1559 /**
1560 * Constructs Intl.DateTimeFormat object given optional locales and options 1560 * Constructs Intl.DateTimeFormat object given optional locales and options
1561 * parameters. 1561 * parameters.
1562 * 1562 *
1563 * @constructor 1563 * @constructor
1564 */ 1564 */
1565 %SetProperty(Intl, 'DateTimeFormat', function() { 1565 %AddProperty(Intl, 'DateTimeFormat', function() {
1566 var locales = %_Arguments(0); 1566 var locales = %_Arguments(0);
1567 var options = %_Arguments(1); 1567 var options = %_Arguments(1);
1568 1568
1569 if (!this || this === Intl) { 1569 if (!this || this === Intl) {
1570 // Constructor is called as a function. 1570 // Constructor is called as a function.
1571 return new Intl.DateTimeFormat(locales, options); 1571 return new Intl.DateTimeFormat(locales, options);
1572 } 1572 }
1573 1573
1574 return initializeDateTimeFormat(ToObject(this), locales, options); 1574 return initializeDateTimeFormat(ToObject(this), locales, options);
1575 }, 1575 },
1576 DONT_ENUM 1576 DONT_ENUM
1577 ); 1577 );
1578 1578
1579 1579
1580 /** 1580 /**
1581 * DateTimeFormat resolvedOptions method. 1581 * DateTimeFormat resolvedOptions method.
1582 */ 1582 */
1583 %SetProperty(Intl.DateTimeFormat.prototype, 'resolvedOptions', function() { 1583 %AddProperty(Intl.DateTimeFormat.prototype, 'resolvedOptions', function() {
1584 if (%_IsConstructCall()) { 1584 if (%_IsConstructCall()) {
1585 throw new $TypeError(ORDINARY_FUNCTION_CALLED_AS_CONSTRUCTOR); 1585 throw new $TypeError(ORDINARY_FUNCTION_CALLED_AS_CONSTRUCTOR);
1586 } 1586 }
1587 1587
1588 if (!%IsInitializedIntlObjectOfType(this, 'dateformat')) { 1588 if (!%IsInitializedIntlObjectOfType(this, 'dateformat')) {
1589 throw new $TypeError('resolvedOptions method called on a non-object or ' + 1589 throw new $TypeError('resolvedOptions method called on a non-object or ' +
1590 'on a object that is not Intl.DateTimeFormat.'); 1590 'on a object that is not Intl.DateTimeFormat.');
1591 } 1591 }
1592 1592
1593 var format = this; 1593 var format = this;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1629 %FunctionRemovePrototype(Intl.DateTimeFormat.prototype.resolvedOptions); 1629 %FunctionRemovePrototype(Intl.DateTimeFormat.prototype.resolvedOptions);
1630 %SetNativeFlag(Intl.DateTimeFormat.prototype.resolvedOptions); 1630 %SetNativeFlag(Intl.DateTimeFormat.prototype.resolvedOptions);
1631 1631
1632 1632
1633 /** 1633 /**
1634 * Returns the subset of the given locale list for which this locale list 1634 * Returns the subset of the given locale list for which this locale list
1635 * has a matching (possibly fallback) locale. Locales appear in the same 1635 * has a matching (possibly fallback) locale. Locales appear in the same
1636 * order in the returned list as in the input list. 1636 * order in the returned list as in the input list.
1637 * Options are optional parameter. 1637 * Options are optional parameter.
1638 */ 1638 */
1639 %SetProperty(Intl.DateTimeFormat, 'supportedLocalesOf', function(locales) { 1639 %AddProperty(Intl.DateTimeFormat, 'supportedLocalesOf', function(locales) {
1640 if (%_IsConstructCall()) { 1640 if (%_IsConstructCall()) {
1641 throw new $TypeError(ORDINARY_FUNCTION_CALLED_AS_CONSTRUCTOR); 1641 throw new $TypeError(ORDINARY_FUNCTION_CALLED_AS_CONSTRUCTOR);
1642 } 1642 }
1643 1643
1644 return supportedLocalesOf('dateformat', locales, %_Arguments(1)); 1644 return supportedLocalesOf('dateformat', locales, %_Arguments(1));
1645 }, 1645 },
1646 DONT_ENUM 1646 DONT_ENUM
1647 ); 1647 );
1648 %FunctionSetName(Intl.DateTimeFormat.supportedLocalesOf, 'supportedLocalesOf'); 1648 %FunctionSetName(Intl.DateTimeFormat.supportedLocalesOf, 'supportedLocalesOf');
1649 %FunctionRemovePrototype(Intl.DateTimeFormat.supportedLocalesOf); 1649 %FunctionRemovePrototype(Intl.DateTimeFormat.supportedLocalesOf);
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
1761 return iterator; 1761 return iterator;
1762 } 1762 }
1763 1763
1764 1764
1765 /** 1765 /**
1766 * Constructs Intl.v8BreakIterator object given optional locales and options 1766 * Constructs Intl.v8BreakIterator object given optional locales and options
1767 * parameters. 1767 * parameters.
1768 * 1768 *
1769 * @constructor 1769 * @constructor
1770 */ 1770 */
1771 %SetProperty(Intl, 'v8BreakIterator', function() { 1771 %AddProperty(Intl, 'v8BreakIterator', function() {
1772 var locales = %_Arguments(0); 1772 var locales = %_Arguments(0);
1773 var options = %_Arguments(1); 1773 var options = %_Arguments(1);
1774 1774
1775 if (!this || this === Intl) { 1775 if (!this || this === Intl) {
1776 // Constructor is called as a function. 1776 // Constructor is called as a function.
1777 return new Intl.v8BreakIterator(locales, options); 1777 return new Intl.v8BreakIterator(locales, options);
1778 } 1778 }
1779 1779
1780 return initializeBreakIterator(ToObject(this), locales, options); 1780 return initializeBreakIterator(ToObject(this), locales, options);
1781 }, 1781 },
1782 DONT_ENUM 1782 DONT_ENUM
1783 ); 1783 );
1784 1784
1785 1785
1786 /** 1786 /**
1787 * BreakIterator resolvedOptions method. 1787 * BreakIterator resolvedOptions method.
1788 */ 1788 */
1789 %SetProperty(Intl.v8BreakIterator.prototype, 'resolvedOptions', function() { 1789 %AddProperty(Intl.v8BreakIterator.prototype, 'resolvedOptions', function() {
1790 if (%_IsConstructCall()) { 1790 if (%_IsConstructCall()) {
1791 throw new $TypeError(ORDINARY_FUNCTION_CALLED_AS_CONSTRUCTOR); 1791 throw new $TypeError(ORDINARY_FUNCTION_CALLED_AS_CONSTRUCTOR);
1792 } 1792 }
1793 1793
1794 if (!%IsInitializedIntlObjectOfType(this, 'breakiterator')) { 1794 if (!%IsInitializedIntlObjectOfType(this, 'breakiterator')) {
1795 throw new $TypeError('resolvedOptions method called on a non-object or ' + 1795 throw new $TypeError('resolvedOptions method called on a non-object or ' +
1796 'on a object that is not Intl.v8BreakIterator.'); 1796 'on a object that is not Intl.v8BreakIterator.');
1797 } 1797 }
1798 1798
1799 var segmenter = this; 1799 var segmenter = this;
(...skipping 12 matching lines...) Expand all
1812 %FunctionRemovePrototype(Intl.v8BreakIterator.prototype.resolvedOptions); 1812 %FunctionRemovePrototype(Intl.v8BreakIterator.prototype.resolvedOptions);
1813 %SetNativeFlag(Intl.v8BreakIterator.prototype.resolvedOptions); 1813 %SetNativeFlag(Intl.v8BreakIterator.prototype.resolvedOptions);
1814 1814
1815 1815
1816 /** 1816 /**
1817 * Returns the subset of the given locale list for which this locale list 1817 * Returns the subset of the given locale list for which this locale list
1818 * has a matching (possibly fallback) locale. Locales appear in the same 1818 * has a matching (possibly fallback) locale. Locales appear in the same
1819 * order in the returned list as in the input list. 1819 * order in the returned list as in the input list.
1820 * Options are optional parameter. 1820 * Options are optional parameter.
1821 */ 1821 */
1822 %SetProperty(Intl.v8BreakIterator, 'supportedLocalesOf', function(locales) { 1822 %AddProperty(Intl.v8BreakIterator, 'supportedLocalesOf', function(locales) {
1823 if (%_IsConstructCall()) { 1823 if (%_IsConstructCall()) {
1824 throw new $TypeError(ORDINARY_FUNCTION_CALLED_AS_CONSTRUCTOR); 1824 throw new $TypeError(ORDINARY_FUNCTION_CALLED_AS_CONSTRUCTOR);
1825 } 1825 }
1826 1826
1827 return supportedLocalesOf('breakiterator', locales, %_Arguments(1)); 1827 return supportedLocalesOf('breakiterator', locales, %_Arguments(1));
1828 }, 1828 },
1829 DONT_ENUM 1829 DONT_ENUM
1830 ); 1830 );
1831 %FunctionSetName(Intl.v8BreakIterator.supportedLocalesOf, 'supportedLocalesOf'); 1831 %FunctionSetName(Intl.v8BreakIterator.supportedLocalesOf, 'supportedLocalesOf');
1832 %FunctionRemovePrototype(Intl.v8BreakIterator.supportedLocalesOf); 1832 %FunctionRemovePrototype(Intl.v8BreakIterator.supportedLocalesOf);
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
2098 writable: true, 2098 writable: true,
2099 configurable: true, 2099 configurable: true,
2100 enumerable: false 2100 enumerable: false
2101 }); 2101 });
2102 %FunctionSetName($Date.prototype.toLocaleTimeString, 'toLocaleTimeString'); 2102 %FunctionSetName($Date.prototype.toLocaleTimeString, 'toLocaleTimeString');
2103 %FunctionRemovePrototype($Date.prototype.toLocaleTimeString); 2103 %FunctionRemovePrototype($Date.prototype.toLocaleTimeString);
2104 %SetNativeFlag($Date.prototype.toLocaleTimeString); 2104 %SetNativeFlag($Date.prototype.toLocaleTimeString);
2105 2105
2106 return Intl; 2106 return Intl;
2107 }())}); 2107 }())});
OLDNEW
« no previous file with comments | « src/generator.js ('k') | src/ia32/full-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698