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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 usage: coll.resolved.usage, | 161 usage: coll.resolved.usage, |
162 sensitivity: coll.resolved.sensitivity, | 162 sensitivity: coll.resolved.sensitivity, |
163 ignorePunctuation: coll.resolved.ignorePunctuation, | 163 ignorePunctuation: coll.resolved.ignorePunctuation, |
164 numeric: coll.resolved.numeric, | 164 numeric: coll.resolved.numeric, |
165 caseFirst: coll.resolved.caseFirst, | 165 caseFirst: coll.resolved.caseFirst, |
166 collation: coll.resolved.collation | 166 collation: coll.resolved.collation |
167 }; | 167 }; |
168 }, | 168 }, |
169 ATTRIBUTES.DONT_ENUM | 169 ATTRIBUTES.DONT_ENUM |
170 ); | 170 ); |
| 171 %FunctionSetName(Intl.Collator.prototype.resolvedOptions, 'resolvedOptions'); |
171 %FunctionRemovePrototype(Intl.Collator.prototype.resolvedOptions); | 172 %FunctionRemovePrototype(Intl.Collator.prototype.resolvedOptions); |
| 173 %SetNativeFlag(Intl.Collator.prototype.resolvedOptions); |
172 | 174 |
173 | 175 |
174 /** | 176 /** |
175 * Returns the subset of the given locale list for which this locale list | 177 * Returns the subset of the given locale list for which this locale list |
176 * has a matching (possibly fallback) locale. Locales appear in the same | 178 * has a matching (possibly fallback) locale. Locales appear in the same |
177 * order in the returned list as in the input list. | 179 * order in the returned list as in the input list. |
178 * Options are optional parameter. | 180 * Options are optional parameter. |
179 */ | 181 */ |
180 %SetProperty(Intl.Collator, 'supportedLocalesOf', function(locales) { | 182 %SetProperty(Intl.Collator, 'supportedLocalesOf', function(locales) { |
181 if (%_IsConstructCall()) { | 183 if (%_IsConstructCall()) { |
182 throw new TypeError(ORDINARY_FUNCTION_CALLED_AS_CONSTRUCTOR); | 184 throw new TypeError(ORDINARY_FUNCTION_CALLED_AS_CONSTRUCTOR); |
183 } | 185 } |
184 | 186 |
185 return supportedLocalesOf('collator', locales, arguments[1]); | 187 return supportedLocalesOf('collator', locales, arguments[1]); |
186 }, | 188 }, |
187 ATTRIBUTES.DONT_ENUM | 189 ATTRIBUTES.DONT_ENUM |
188 ); | 190 ); |
| 191 %FunctionSetName(Intl.Collator.supportedLocalesOf, 'supportedLocalesOf'); |
189 %FunctionRemovePrototype(Intl.Collator.supportedLocalesOf); | 192 %FunctionRemovePrototype(Intl.Collator.supportedLocalesOf); |
| 193 %SetNativeFlag(Intl.Collator.supportedLocalesOf); |
190 | 194 |
191 | 195 |
192 /** | 196 /** |
193 * When the compare method is called with two arguments x and y, it returns a | 197 * When the compare method is called with two arguments x and y, it returns a |
194 * Number other than NaN that represents the result of a locale-sensitive | 198 * Number other than NaN that represents the result of a locale-sensitive |
195 * String comparison of x with y. | 199 * String comparison of x with y. |
196 * The result is intended to order String values in the sort order specified | 200 * The result is intended to order String values in the sort order specified |
197 * by the effective locale and collation options computed during construction | 201 * by the effective locale and collation options computed during construction |
198 * of this Collator object, and will be negative, zero, or positive, depending | 202 * of this Collator object, and will be negative, zero, or positive, depending |
199 * on whether x comes before y in the sort order, the Strings are equal under | 203 * on whether x comes before y in the sort order, the Strings are equal under |
200 * the sort order, or x comes after y in the sort order, respectively. | 204 * the sort order, or x comes after y in the sort order, respectively. |
201 */ | 205 */ |
202 function compare(collator, x, y) { | 206 function compare(collator, x, y) { |
203 native function NativeJSInternalCompare(); | 207 native function NativeJSInternalCompare(); |
204 return NativeJSInternalCompare(collator.collator, String(x), String(y)); | 208 return NativeJSInternalCompare(collator.collator, String(x), String(y)); |
205 }; | 209 }; |
206 | 210 |
207 | 211 |
208 addBoundMethod(Intl.Collator, 'compare', compare, 2); | 212 addBoundMethod(Intl.Collator, 'compare', compare, 2); |
OLD | NEW |