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 23 matching lines...) Expand all Loading... | |
34 var MakeError; | 34 var MakeError; |
35 var MakeRangeError; | 35 var MakeRangeError; |
36 var MakeTypeError; | 36 var MakeTypeError; |
37 var ObjectHasOwnProperty = utils.ImportNow("ObjectHasOwnProperty"); | 37 var ObjectHasOwnProperty = utils.ImportNow("ObjectHasOwnProperty"); |
38 var OverrideFunction = utils.OverrideFunction; | 38 var OverrideFunction = utils.OverrideFunction; |
39 var patternSymbol = utils.ImportNow("intl_pattern_symbol"); | 39 var patternSymbol = utils.ImportNow("intl_pattern_symbol"); |
40 var resolvedSymbol = utils.ImportNow("intl_resolved_symbol"); | 40 var resolvedSymbol = utils.ImportNow("intl_resolved_symbol"); |
41 var SetFunctionName = utils.SetFunctionName; | 41 var SetFunctionName = utils.SetFunctionName; |
42 var StringIndexOf; | 42 var StringIndexOf; |
43 var StringLastIndexOf; | 43 var StringLastIndexOf; |
44 var StringSplit; | |
45 var StringSubstr; | 44 var StringSubstr; |
46 var StringSubstring; | 45 var StringSubstring; |
47 | 46 |
48 utils.Import(function(from) { | 47 utils.Import(function(from) { |
49 ArrayIndexOf = from.ArrayIndexOf; | 48 ArrayIndexOf = from.ArrayIndexOf; |
50 ArrayJoin = from.ArrayJoin; | 49 ArrayJoin = from.ArrayJoin; |
51 ArrayPush = from.ArrayPush; | 50 ArrayPush = from.ArrayPush; |
52 IsNaN = from.IsNaN; | 51 IsNaN = from.IsNaN; |
53 MakeError = from.MakeError; | 52 MakeError = from.MakeError; |
54 MakeRangeError = from.MakeRangeError; | 53 MakeRangeError = from.MakeRangeError; |
55 MakeTypeError = from.MakeTypeError; | 54 MakeTypeError = from.MakeTypeError; |
56 InternalRegExpMatch = from.InternalRegExpMatch; | 55 InternalRegExpMatch = from.InternalRegExpMatch; |
57 InternalRegExpReplace = from.InternalRegExpReplace; | 56 InternalRegExpReplace = from.InternalRegExpReplace; |
58 StringIndexOf = from.StringIndexOf; | 57 StringIndexOf = from.StringIndexOf; |
59 StringLastIndexOf = from.StringLastIndexOf; | 58 StringLastIndexOf = from.StringLastIndexOf; |
60 StringSplit = from.StringSplit; | |
61 StringSubstr = from.StringSubstr; | 59 StringSubstr = from.StringSubstr; |
62 StringSubstring = from.StringSubstring; | 60 StringSubstring = from.StringSubstring; |
63 }); | 61 }); |
64 | 62 |
65 utils.ImportFromExperimental(function(from) { | 63 utils.ImportFromExperimental(function(from) { |
66 FLAG_intl_extra = from.FLAG_intl_extra; | 64 FLAG_intl_extra = from.FLAG_intl_extra; |
67 }); | 65 }); |
68 | 66 |
69 // Utilities for definitions | 67 // Utilities for definitions |
70 | 68 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
118 this[internalName] = boundMethod; | 116 this[internalName] = boundMethod; |
119 } | 117 } |
120 return this[internalName]; | 118 return this[internalName]; |
121 }); | 119 }); |
122 | 120 |
123 %FunctionRemovePrototype(getter); | 121 %FunctionRemovePrototype(getter); |
124 %DefineGetterPropertyUnchecked(obj.prototype, methodName, getter, DONT_ENUM); | 122 %DefineGetterPropertyUnchecked(obj.prototype, methodName, getter, DONT_ENUM); |
125 %SetNativeFlag(getter); | 123 %SetNativeFlag(getter); |
126 } | 124 } |
127 | 125 |
126 // Special StringSplit function for this file; does not work with RegExps | |
127 // or access Symbol.split, but per spec, is just for strings. | |
128 function StringSplit(separator, limit) { | |
129 var subject = TO_STRING(this); | |
130 var separator_string = TO_STRING(separator); | |
131 limit = (IS_UNDEFINED(limit)) ? kMaxUint32 : TO_UINT32(limit); | |
Yang
2016/07/07 09:13:01
I don't think StringSplit is used with the optiona
Dan Ehrenberg
2016/07/07 18:35:42
That's true; I don't see a real need to call TO_ST
| |
132 return %StringSplit(this, separator, limit); | |
133 } | |
134 | |
128 // ------------------------------------------------------------------- | 135 // ------------------------------------------------------------------- |
129 | 136 |
130 var Intl = {}; | 137 var Intl = {}; |
131 | 138 |
132 %AddNamedProperty(global, "Intl", Intl, DONT_ENUM); | 139 %AddNamedProperty(global, "Intl", Intl, DONT_ENUM); |
133 | 140 |
134 /** | 141 /** |
135 * Caches available locales for each service. | 142 * Caches available locales for each service. |
136 */ | 143 */ |
137 var AVAILABLE_LOCALES = { | 144 var AVAILABLE_LOCALES = { |
(...skipping 2113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2251 } | 2258 } |
2252 ); | 2259 ); |
2253 | 2260 |
2254 utils.Export(function(to) { | 2261 utils.Export(function(to) { |
2255 to.AddBoundMethod = AddBoundMethod; | 2262 to.AddBoundMethod = AddBoundMethod; |
2256 to.IntlParseDate = IntlParseDate; | 2263 to.IntlParseDate = IntlParseDate; |
2257 to.IntlParseNumber = IntlParseNumber; | 2264 to.IntlParseNumber = IntlParseNumber; |
2258 }); | 2265 }); |
2259 | 2266 |
2260 }) | 2267 }) |
OLD | NEW |