Chromium Code Reviews| Index: src/js/i18n.js |
| diff --git a/src/js/i18n.js b/src/js/i18n.js |
| index a859a9fbeb9f1028e0c6245364a800651d8e7f29..f914c032bb4793cdbb09b289207f9bb105461abf 100644 |
| --- a/src/js/i18n.js |
| +++ b/src/js/i18n.js |
| @@ -33,6 +33,7 @@ var MakeTypeError; |
| var MathFloor; |
| var ObjectDefineProperties = utils.ImportNow("ObjectDefineProperties"); |
| var ObjectDefineProperty = utils.ImportNow("ObjectDefineProperty"); |
| +var patternSymbol = utils.ImportNow("pattern_symbol"); |
| var RegExpTest; |
| var StringIndexOf; |
| var StringLastIndexOf; |
| @@ -41,6 +42,7 @@ var StringReplace; |
| var StringSplit; |
| var StringSubstr; |
| var StringSubstring; |
| +const kIntlPattern = 15; |
| utils.Import(function(from) { |
| ArrayIndexOf = from.ArrayIndexOf; |
| @@ -1157,6 +1159,10 @@ function initializeNumberFormat(numberFormat, locales, options) { |
| minimumFractionDigits: {writable: true}, |
| minimumIntegerDigits: {writable: true}, |
| numberingSystem: {writable: true}, |
| + pattern: {get() { |
| + %IncrementUseCounter(kIntlPattern); |
| + return this[patternSymbol]; |
| + }}, |
| requestedLocale: {value: requestedLocale, writable: true}, |
| style: {value: internalOptions.style, writable: true}, |
| useGrouping: {writable: true} |
| @@ -1561,7 +1567,11 @@ function initializeDateTimeFormat(dateFormat, locales, options) { |
| minute: {writable: true}, |
| month: {writable: true}, |
| numberingSystem: {writable: true}, |
| - pattern: {writable: true}, |
| + [patternSymbol]: {writable: true}, |
| + pattern: {get() { |
|
adamk
2016/01/05 19:10:09
Don't you want a setter too, since the old propert
Dan Ehrenberg
2016/01/06 03:20:55
Oh, good point. Done.
|
| + %IncrementUseCounter(kIntlPattern); |
| + return this[patternSymbol]; |
| + }}, |
| requestedLocale: {value: requestedLocale, writable: true}, |
| second: {writable: true}, |
| timeZone: {writable: true}, |
| @@ -1638,7 +1648,7 @@ function initializeDateTimeFormat(dateFormat, locales, options) { |
| }; |
| var format = this; |
| - var fromPattern = fromLDMLString(format.resolved.pattern); |
| + var fromPattern = fromLDMLString(format.resolved[patternSymbol]); |
| var userCalendar = ICU_CALENDAR_MAP[format.resolved.calendar]; |
| if (IS_UNDEFINED(userCalendar)) { |
| // Use ICU name if we don't have a match. It shouldn't happen, but |