|
|
|
@ -27,9 +27,15 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness
@@ -27,9 +27,15 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness
|
|
|
|
|
AvoidLifting(); |
|
|
|
|
BitNot(); |
|
|
|
|
FieldAccessOrderOfEvaluation(null); |
|
|
|
|
FieldAccessOrderOfEvaluationWithStruct(null); |
|
|
|
|
ArrayAccessOrderOfEvaluation(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
struct SomeStruct |
|
|
|
|
{ |
|
|
|
|
public int IntField; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void AvoidLifting() |
|
|
|
|
{ |
|
|
|
|
Console.WriteLine("MayThrow:"); |
|
|
|
@ -113,6 +119,27 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness
@@ -113,6 +119,27 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
SomeStruct structField; |
|
|
|
|
|
|
|
|
|
static void FieldAccessOrderOfEvaluationWithStruct(NullableTests c) |
|
|
|
|
{ |
|
|
|
|
Console.WriteLine("GetInt, then NRE (with struct):"); |
|
|
|
|
try { |
|
|
|
|
c.structField.IntField = GetValue<int>(); |
|
|
|
|
} catch (Exception ex) { |
|
|
|
|
Console.WriteLine(ex.Message); |
|
|
|
|
} |
|
|
|
|
Console.WriteLine("NRE before GetInt (with struct):"); |
|
|
|
|
try { |
|
|
|
|
#if CS60
|
|
|
|
|
ref SomeStruct s = ref c.structField; |
|
|
|
|
s.IntField = GetValue<int>(); |
|
|
|
|
#endif
|
|
|
|
|
} catch (Exception ex) { |
|
|
|
|
Console.WriteLine(ex.Message); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static T[] GetArray<T>() |
|
|
|
|
{ |
|
|
|
|
Console.WriteLine("GetArray"); |
|
|
|
|