Make internal cache vars private (flutter/engine#15699)

This commit is contained in:
Dan Field
2020-01-16 16:10:25 -08:00
committed by GitHub
parent c11bbb2872
commit 0eb30b4fcd

View File

@@ -483,8 +483,8 @@ class Locale {
@override @override
int get hashCode => hashValues(languageCode, scriptCode, countryCode); int get hashCode => hashValues(languageCode, scriptCode, countryCode);
static Locale cachedLocale; static Locale _cachedLocale;
static String cachedLocaleString; static String _cachedLocaleString;
/// Returns a string representing the locale. /// Returns a string representing the locale.
/// ///
@@ -493,11 +493,11 @@ class Locale {
/// purposes only. For parseable results, use [toLanguageTag] instead. /// purposes only. For parseable results, use [toLanguageTag] instead.
@override @override
String toString() { String toString() {
if (!identical(cachedLocale, this)) { if (!identical(_cachedLocale, this)) {
cachedLocale = this; _cachedLocale = this;
cachedLocaleString = _rawToString('_'); _cachedLocaleString = _rawToString('_');
} }
return cachedLocaleString; return _cachedLocaleString;
} }
/// Returns a syntactically valid Unicode BCP47 Locale Identifier. /// Returns a syntactically valid Unicode BCP47 Locale Identifier.