summaryrefslogtreecommitdiff
path: root/src/mscorlib/src/System/Globalization/HebrewCalendar.cs
diff options
context:
space:
mode:
authorJiyoung Yun <jy910.yun@samsung.com>2016-12-27 16:46:08 +0900
committerJiyoung Yun <jy910.yun@samsung.com>2016-12-27 16:46:08 +0900
commitdb20f3f1bb8595633a7e16c8900fd401a453a6b5 (patch)
treee5435159cd1bf0519276363a6fe1663d1721bed3 /src/mscorlib/src/System/Globalization/HebrewCalendar.cs
parent4b4aad7217d3292650e77eec2cf4c198ea9c3b4b (diff)
downloadcoreclr-db20f3f1bb8595633a7e16c8900fd401a453a6b5.tar.gz
coreclr-db20f3f1bb8595633a7e16c8900fd401a453a6b5.tar.bz2
coreclr-db20f3f1bb8595633a7e16c8900fd401a453a6b5.zip
Imported Upstream version 1.0.0.9127upstream/1.0.0.9127
Diffstat (limited to 'src/mscorlib/src/System/Globalization/HebrewCalendar.cs')
-rw-r--r--src/mscorlib/src/System/Globalization/HebrewCalendar.cs31
1 files changed, 16 insertions, 15 deletions
diff --git a/src/mscorlib/src/System/Globalization/HebrewCalendar.cs b/src/mscorlib/src/System/Globalization/HebrewCalendar.cs
index 3a17494001..44cbdb8bde 100644
--- a/src/mscorlib/src/System/Globalization/HebrewCalendar.cs
+++ b/src/mscorlib/src/System/Globalization/HebrewCalendar.cs
@@ -5,6 +5,7 @@
namespace System.Globalization {
using System;
using System.Text;
+ using System.Diagnostics;
using System.Diagnostics.Contracts;
////////////////////////////////////////////////////////////////////////////
@@ -397,7 +398,7 @@ namespace System.Globalization {
int monthsInYear = GetMonthsInYear(year, era);
if (month < 1 || month > monthsInYear) {
throw new ArgumentOutOfRangeException(
- "month",
+ nameof(month),
String.Format(
CultureInfo.CurrentCulture,
Environment.GetResourceString("ArgumentOutOfRange_Range"),
@@ -421,7 +422,7 @@ namespace System.Globalization {
int daysInMonth = GetDaysInMonth(year, month, era);
if (day < 1 || day > daysInMonth) {
throw new ArgumentOutOfRangeException(
- "day",
+ nameof(day),
String.Format(
CultureInfo.CurrentCulture,
Environment.GetResourceString("ArgumentOutOfRange_Range"),
@@ -432,7 +433,7 @@ namespace System.Globalization {
static internal void CheckEraRange(int era) {
if (era != CurrentEra && era != HebrewEra) {
- throw new ArgumentOutOfRangeException("era", Environment.GetResourceString("ArgumentOutOfRange_InvalidEraValue"));
+ throw new ArgumentOutOfRangeException(nameof(era), Environment.GetResourceString("ArgumentOutOfRange_InvalidEraValue"));
}
}
@@ -486,7 +487,7 @@ namespace System.Globalization {
//
int index = gregorianYear - FirstGregorianTableYear;
if (index < 0 || index > TABLESIZE) {
- throw new ArgumentOutOfRangeException("gregorianYear");
+ throw new ArgumentOutOfRangeException(nameof(gregorianYear));
}
index *= 2;
@@ -607,7 +608,7 @@ namespace System.Globalization {
// is true.
//
NumDays -= (long)(LunarMonthLen[hebrewYearType, lunarDate.month] - lunarDate.day);
- Contract.Assert(NumDays >= 1, "NumDays >= 1");
+ Debug.Assert(NumDays >= 1, "NumDays >= 1");
// If NumDays is 1, then we are done. Otherwise, find the correct Hebrew month
// and day.
@@ -705,7 +706,7 @@ namespace System.Globalization {
catch (ArgumentException)
{
throw new ArgumentOutOfRangeException(
- "months",
+ nameof(months),
String.Format(
CultureInfo.CurrentCulture,
Environment.GetResourceString("ArgumentOutOfRange_AddValue")));
@@ -727,7 +728,7 @@ namespace System.Globalization {
int d = GetDatePart(time.Ticks, DatePartDay);
y += years;
- CheckHebrewYearValue(y, Calendar.CurrentEra, "years");
+ CheckHebrewYearValue(y, Calendar.CurrentEra, nameof(years));
int months = GetMonthsInYear(y, CurrentEra);
if (m > months) {
@@ -765,7 +766,7 @@ namespace System.Globalization {
}
static internal int GetHebrewYearType(int year, int era) {
- CheckHebrewYearValue(year, era, "year");
+ CheckHebrewYearValue(year, era, nameof(year));
// The HebrewTable is indexed by Gregorian year and starts from FirstGregorianYear.
// So we need to convert year (Hebrew year value) to Gregorian Year below.
return (HebrewTable[(year - HebrewYearOf1AD - FirstGregorianTableYear) * 2 + 1]);
@@ -811,11 +812,11 @@ namespace System.Globalization {
int hebrewYearType = GetHebrewYearType(year, era);
CheckHebrewMonthValue(year, month, era);
- Contract.Assert(hebrewYearType>= 1 && hebrewYearType <= 6,
+ Debug.Assert(hebrewYearType>= 1 && hebrewYearType <= 6,
"hebrewYearType should be from 1 to 6, but now hebrewYearType = " + hebrewYearType + " for hebrew year " + year);
int monthDays = LunarMonthLen[hebrewYearType, month];
if (monthDays == 0) {
- throw new ArgumentOutOfRangeException("month", Environment.GetResourceString("ArgumentOutOfRange_Month"));
+ throw new ArgumentOutOfRangeException(nameof(month), Environment.GetResourceString("ArgumentOutOfRange_Month"));
}
return (monthDays);
}
@@ -931,7 +932,7 @@ namespace System.Globalization {
//
public override bool IsLeapYear(int year, int era) {
- CheckHebrewYearValue(year, era, "year");
+ CheckHebrewYearValue(year, era, nameof(year));
return (((7 * (long)year + 1) % 19) < 7);
}
@@ -1015,7 +1016,7 @@ namespace System.Globalization {
//
public override DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era) {
- CheckHebrewYearValue(year, era, "year");
+ CheckHebrewYearValue(year, era, nameof(year));
CheckHebrewMonthValue(year, month, era);
CheckHebrewDayValue(year, month, day, era);
DateTime dt = HebrewToGregorian(year, month, day, hour, minute, second, millisecond);
@@ -1042,7 +1043,7 @@ namespace System.Globalization {
}
else
{
- CheckHebrewYearValue(value, HebrewEra, "value");
+ CheckHebrewYearValue(value, HebrewEra, nameof(value));
}
twoDigitYearMax = value;
}
@@ -1051,7 +1052,7 @@ namespace System.Globalization {
public override int ToFourDigitYear(int year) {
if (year < 0) {
- throw new ArgumentOutOfRangeException("year",
+ throw new ArgumentOutOfRangeException(nameof(year),
Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
}
Contract.EndContractBlock();
@@ -1062,7 +1063,7 @@ namespace System.Globalization {
if (year > MaxHebrewYear || year < MinHebrewYear) {
throw new ArgumentOutOfRangeException(
- "year",
+ nameof(year),
String.Format(
CultureInfo.CurrentCulture,
Environment.GetResourceString("ArgumentOutOfRange_Range"),