diff options
author | Martin Baulig <mabaul@microsoft.com> | 2019-06-06 00:15:15 +0300 |
---|---|---|
committer | Marek Safar <marek.safar@gmail.com> | 2019-06-06 14:40:53 +0300 |
commit | 3998dc01c9a36c293fd2523128f8f20730bd02da (patch) | |
tree | 375c181904f534322877ad597b7beb5f26973b40 /mcs/class/referencesource | |
parent | 51202617a1f207d4baea0acbc66e9f215a039431 (diff) |
Make `CalendarData` more linker friendly.
See https://github.com/mono/corefx/pull/298 for a description of the
technique that we're using here to make it more linker friendly.
Diffstat (limited to 'mcs/class/referencesource')
-rw-r--r-- | mcs/class/referencesource/mscorlib/system/globalization/calendardata.cs | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/mcs/class/referencesource/mscorlib/system/globalization/calendardata.cs b/mcs/class/referencesource/mscorlib/system/globalization/calendardata.cs index 9506b6f8466..64a6e1a3d20 100644 --- a/mcs/class/referencesource/mscorlib/system/globalization/calendardata.cs +++ b/mcs/class/referencesource/mscorlib/system/globalization/calendardata.cs @@ -186,7 +186,7 @@ namespace System.Globalization // Abbreviated English Era Names are only used for the Japanese calendar. if (!GlobalizationMode.Invariant && calendarId == (int)CalendarId.JAPAN) { - this.saAbbrevEnglishEraNames = JapaneseCalendar.EnglishEraNames(); + this.saAbbrevEnglishEraNames = GetJapaneseEnglishEraNames(); } else { @@ -268,11 +268,7 @@ namespace System.Globalization case CalendarId.JAPAN: case CalendarId.JAPANESELUNISOLAR: - if (GlobalizationMode.Invariant) - { - throw new PlatformNotSupportedException(); - } - this.saEraNames = JapaneseCalendar.EraNames(); + this.saEraNames = GetJapaneseEraNames (); break; case CalendarId.PERSIAN: @@ -289,6 +285,20 @@ namespace System.Globalization } } + private static string[] GetJapaneseEraNames() + { + if (GlobalizationMode.Invariant) + throw new PlatformNotSupportedException(); + return JapaneseCalendar.EraNames(); + } + + private static string[] GetJapaneseEnglishEraNames() + { + if (GlobalizationMode.Invariant) + throw new PlatformNotSupportedException(); + return JapaneseCalendar.EnglishEraNames(); + } + private void InitializeAbbreviatedEraNames(string localeName, int calendarId) { // Note that the saAbbrevEraNames only include "AD" We don't have localized names for other calendars available from windows |