| 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 14 matching lines...) Expand all Loading... |
| 25 var IsFinite; | 25 var IsFinite; |
| 26 var IsNaN; | 26 var IsNaN; |
| 27 var GlobalBoolean = global.Boolean; | 27 var GlobalBoolean = global.Boolean; |
| 28 var GlobalDate = global.Date; | 28 var GlobalDate = global.Date; |
| 29 var GlobalNumber = global.Number; | 29 var GlobalNumber = global.Number; |
| 30 var GlobalRegExp = global.RegExp; | 30 var GlobalRegExp = global.RegExp; |
| 31 var GlobalString = global.String; | 31 var GlobalString = global.String; |
| 32 var MakeError; | 32 var MakeError; |
| 33 var MakeRangeError; | 33 var MakeRangeError; |
| 34 var MakeTypeError; | 34 var MakeTypeError; |
| 35 var MathFloor; | |
| 36 var ObjectDefineProperties = utils.ImportNow("ObjectDefineProperties"); | 35 var ObjectDefineProperties = utils.ImportNow("ObjectDefineProperties"); |
| 37 var ObjectDefineProperty = utils.ImportNow("ObjectDefineProperty"); | 36 var ObjectDefineProperty = utils.ImportNow("ObjectDefineProperty"); |
| 38 var ObjectHasOwnProperty = utils.ImportNow("ObjectHasOwnProperty"); | 37 var ObjectHasOwnProperty = utils.ImportNow("ObjectHasOwnProperty"); |
| 39 var patternSymbol = utils.ImportNow("intl_pattern_symbol"); | 38 var patternSymbol = utils.ImportNow("intl_pattern_symbol"); |
| 40 var RegExpTest; | 39 var RegExpTest; |
| 41 var resolvedSymbol = utils.ImportNow("intl_resolved_symbol"); | 40 var resolvedSymbol = utils.ImportNow("intl_resolved_symbol"); |
| 42 var SetFunctionName = utils.SetFunctionName; | 41 var SetFunctionName = utils.SetFunctionName; |
| 43 var StringIndexOf; | 42 var StringIndexOf; |
| 44 var StringLastIndexOf; | 43 var StringLastIndexOf; |
| 45 var StringMatch; | 44 var StringMatch; |
| 46 var StringReplace; | 45 var StringReplace; |
| 47 var StringSplit; | 46 var StringSplit; |
| 48 var StringSubstr; | 47 var StringSubstr; |
| 49 var StringSubstring; | 48 var StringSubstring; |
| 50 | 49 |
| 51 utils.Import(function(from) { | 50 utils.Import(function(from) { |
| 52 ArrayIndexOf = from.ArrayIndexOf; | 51 ArrayIndexOf = from.ArrayIndexOf; |
| 53 ArrayJoin = from.ArrayJoin; | 52 ArrayJoin = from.ArrayJoin; |
| 54 ArrayPush = from.ArrayPush; | 53 ArrayPush = from.ArrayPush; |
| 55 IsFinite = from.IsFinite; | 54 IsFinite = from.IsFinite; |
| 56 IsNaN = from.IsNaN; | 55 IsNaN = from.IsNaN; |
| 57 MakeError = from.MakeError; | 56 MakeError = from.MakeError; |
| 58 MakeRangeError = from.MakeRangeError; | 57 MakeRangeError = from.MakeRangeError; |
| 59 MakeTypeError = from.MakeTypeError; | 58 MakeTypeError = from.MakeTypeError; |
| 60 MathFloor = from.MathFloor; | |
| 61 RegExpTest = from.RegExpTest; | 59 RegExpTest = from.RegExpTest; |
| 62 StringIndexOf = from.StringIndexOf; | 60 StringIndexOf = from.StringIndexOf; |
| 63 StringLastIndexOf = from.StringLastIndexOf; | 61 StringLastIndexOf = from.StringLastIndexOf; |
| 64 StringMatch = from.StringMatch; | 62 StringMatch = from.StringMatch; |
| 65 StringReplace = from.StringReplace; | 63 StringReplace = from.StringReplace; |
| 66 StringSplit = from.StringSplit; | 64 StringSplit = from.StringSplit; |
| 67 StringSubstr = from.StringSubstr; | 65 StringSubstr = from.StringSubstr; |
| 68 StringSubstring = from.StringSubstring; | 66 StringSubstring = from.StringSubstring; |
| 69 }); | 67 }); |
| 70 | 68 |
| (...skipping 1034 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1105 * Returns the valid digit count for a property, or throws RangeError on | 1103 * Returns the valid digit count for a property, or throws RangeError on |
| 1106 * a value out of the range. | 1104 * a value out of the range. |
| 1107 */ | 1105 */ |
| 1108 function getNumberOption(options, property, min, max, fallback) { | 1106 function getNumberOption(options, property, min, max, fallback) { |
| 1109 var value = options[property]; | 1107 var value = options[property]; |
| 1110 if (!IS_UNDEFINED(value)) { | 1108 if (!IS_UNDEFINED(value)) { |
| 1111 value = GlobalNumber(value); | 1109 value = GlobalNumber(value); |
| 1112 if (IsNaN(value) || value < min || value > max) { | 1110 if (IsNaN(value) || value < min || value > max) { |
| 1113 throw MakeRangeError(kPropertyValueOutOfRange, property); | 1111 throw MakeRangeError(kPropertyValueOutOfRange, property); |
| 1114 } | 1112 } |
| 1115 return MathFloor(value); | 1113 return %math_floor(value); |
| 1116 } | 1114 } |
| 1117 | 1115 |
| 1118 return fallback; | 1116 return fallback; |
| 1119 } | 1117 } |
| 1120 | 1118 |
| 1121 var patternAccessor = { | 1119 var patternAccessor = { |
| 1122 get() { | 1120 get() { |
| 1123 %IncrementUseCounter(kIntlPattern); | 1121 %IncrementUseCounter(kIntlPattern); |
| 1124 return this[patternSymbol]; | 1122 return this[patternSymbol]; |
| 1125 }, | 1123 }, |
| (...skipping 1022 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2148 } | 2146 } |
| 2149 | 2147 |
| 2150 var locales = arguments[0]; | 2148 var locales = arguments[0]; |
| 2151 var options = arguments[1]; | 2149 var options = arguments[1]; |
| 2152 return toLocaleDateTime( | 2150 return toLocaleDateTime( |
| 2153 this, locales, options, 'time', 'time', 'dateformattime'); | 2151 this, locales, options, 'time', 'time', 'dateformattime'); |
| 2154 } | 2152 } |
| 2155 ); | 2153 ); |
| 2156 | 2154 |
| 2157 }) | 2155 }) |
| OLD | NEW |