Browse Source

Add support for compound assignment of short integers.

pull/960/head
Daniel Grunwald 8 years ago
parent
commit
40a4f08a8d
  1. 21
      ICSharpCode.Decompiler.Tests/TestCases/Correctness/CompoundAssignment.cs
  2. 105
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/CompoundAssignmentTest.cs
  3. 405
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/CompoundAssignmentTest.il
  4. 342
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/CompoundAssignmentTest.opt.il
  5. 336
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/CompoundAssignmentTest.opt.roslyn.il
  6. 399
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/CompoundAssignmentTest.roslyn.il
  7. 4
      ICSharpCode.Decompiler/CSharp/ExpressionBuilder.cs
  8. 8
      ICSharpCode.Decompiler/IL/Instructions.cs
  9. 4
      ICSharpCode.Decompiler/IL/Instructions.tt
  10. 12
      ICSharpCode.Decompiler/IL/Instructions/CompoundAssignmentInstruction.cs
  11. 27
      ICSharpCode.Decompiler/IL/Transforms/ExpressionTransforms.cs
  12. 81
      ICSharpCode.Decompiler/IL/Transforms/TransformAssignment.cs

21
ICSharpCode.Decompiler.Tests/TestCases/Correctness/CompoundAssignment.cs

@ -30,6 +30,7 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness @@ -30,6 +30,7 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness
CallTwice();
UnsignedShiftRightInstanceField();
UnsignedShiftRightStaticProperty();
DivideByBigValue();
}
static void Test(int a, int b)
@ -76,6 +77,19 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness @@ -76,6 +77,19 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness
}
}
static ushort shortField;
public static ushort ShortProperty {
get {
Console.WriteLine("In get_ShortProperty");
return shortField;
}
set {
Console.WriteLine("In set_ShortProperty, value={0}", value);
shortField = value;
}
}
public static Dictionary<string, int> GetDict()
{
Console.WriteLine("In GetDict()");
@ -133,5 +147,12 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness @@ -133,5 +147,12 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness
StaticProperty = -15;
Test(X(), StaticProperty = (int)((uint)StaticProperty >> 2));
}
static void DivideByBigValue()
{
ShortProperty = 5;
// can't use "ShortProperty /= (ushort)(ushort.MaxValue + 3)" because that would be division by 2.
ShortProperty = (ushort)(ShortProperty / (ushort.MaxValue + 3));
}
}
}

105
ICSharpCode.Decompiler.Tests/TestCases/Pretty/CompoundAssignmentTest.cs

@ -78,6 +78,7 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty @@ -78,6 +78,7 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
private int[] array1;
private StructContainer field1;
private MyEnum enumField;
private ShortEnum shortEnumField;
public static int StaticField;
public static short StaticShortField;
@ -228,8 +229,18 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty @@ -228,8 +229,18 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
{
this.enumField |= MyEnum.Two;
this.enumField &= ~MyEnum.Four;
this.enumField += 2;
this.enumField -= 3;
}
public void ShortEnumTest()
{
this.shortEnumField |= ShortEnum.Two;
this.shortEnumField &= ~ShortEnum.Four;
this.shortEnumField += 2;
this.shortEnumField -= 3;
}
public int PreIncrementInAddition(int i, int j)
{
return i + ++j;
@ -250,21 +261,41 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty @@ -250,21 +261,41 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
array[pos]++;
}
public int PreIncrementShortArrayElement(short[] array, int pos)
public void DoubleArrayElement(int[] array, int pos)
{
array[pos] *= 2;
}
public int DoubleArrayElementAndReturn(int[] array, int pos)
{
return array[pos] *= 2;
}
public int PreIncrementArrayElementShort(short[] array, int pos)
{
return --array[pos];
}
public int PostIncrementShortArrayElement(short[] array, int pos)
public int PostIncrementArrayElementShort(short[] array, int pos)
{
return array[pos]++;
}
public void IncrementShortArrayElement(short[] array, int pos)
public void IncrementArrayElementShort(short[] array, int pos)
{
array[pos]++;
}
public void DoubleArrayElementShort(short[] array, int pos)
{
array[pos] *= 2;
}
public short DoubleArrayElementShortAndReturn(short[] array, int pos)
{
return array[pos] *= 2;
}
public int PreIncrementInstanceField()
{
return ++this.M().Field;
@ -280,6 +311,16 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty @@ -280,6 +311,16 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
this.M().Field++;
}
public void DoubleInstanceField()
{
this.M().Field *= 2;
}
public int DoubleInstanceFieldAndReturn()
{
return this.M().Field *= 2;
}
public int PreIncrementInstanceField2(MutableClass m)
{
return ++m.Field;
@ -325,6 +366,16 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty @@ -325,6 +366,16 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
this.M().Property++;
}
public void DoubleInstanceProperty()
{
this.M().Property *= 2;
}
public int DoubleInstancePropertyAndReturn()
{
return this.M().Property *= 2;
}
public int PreIncrementInstancePropertyByte()
{
return ++this.M().ByteProperty;
@ -340,6 +391,16 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty @@ -340,6 +391,16 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
this.M().ByteProperty++;
}
public void DoubleInstancePropertyByte()
{
this.M().ByteProperty *= 2;
}
public int DoubleInstancePropertyByteAndReturn()
{
return this.M().ByteProperty *= 2;
}
public int PreIncrementStaticField()
{
return ++CompoundAssignmentTest.StaticField;
@ -355,6 +416,16 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty @@ -355,6 +416,16 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
CompoundAssignmentTest.StaticField++;
}
public void DoubleStaticField()
{
CompoundAssignmentTest.StaticField *= 2;
}
public int DoubleStaticFieldAndReturn()
{
return CompoundAssignmentTest.StaticField *= 2;
}
public int PreIncrementStaticFieldShort()
{
return ++CompoundAssignmentTest.StaticShortField;
@ -370,6 +441,16 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty @@ -370,6 +441,16 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
CompoundAssignmentTest.StaticShortField++;
}
public void DoubleStaticFieldShort()
{
CompoundAssignmentTest.StaticShortField *= 2;
}
public short DoubleStaticFieldAndReturnShort()
{
return CompoundAssignmentTest.StaticShortField *= 2;
}
public int PreIncrementStaticProperty()
{
return ++CompoundAssignmentTest.StaticProperty;
@ -385,6 +466,16 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty @@ -385,6 +466,16 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
CompoundAssignmentTest.StaticProperty++;
}
public void DoubleStaticProperty()
{
CompoundAssignmentTest.StaticProperty *= 2;
}
public int DoubleStaticPropertyAndReturn()
{
return CompoundAssignmentTest.StaticProperty *= 2;
}
public ShortEnum PreIncrementStaticPropertyShort()
{
return ++CompoundAssignmentTest.StaticShortProperty;
@ -399,7 +490,7 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty @@ -399,7 +490,7 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
{
CompoundAssignmentTest.StaticShortProperty++;
}
private static Item GetItem(object obj)
{
return null;
@ -411,10 +502,12 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty @@ -411,10 +502,12 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
item.Self = item;
}
void Issue954(ref MyEnum a, MyEnum b)
private void Issue954(ref MyEnum a, MyEnum b)
{
// cannot decompile to: "a %= b;", because the % operator does not apply to enums
a = (MyEnum)((int)a % (int)b);
// same with enum field:
this.enumField = (MyEnum)((int)this.enumField % (int)b);
}
}
}

405
ICSharpCode.Decompiler.Tests/TestCases/Pretty/CompoundAssignmentTest.il

@ -10,7 +10,7 @@ @@ -10,7 +10,7 @@
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly gvvksqgl
.assembly oguadjyn
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 00 00 00 00 00 )
.custom instance void [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = ( 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx
@ -20,15 +20,15 @@ @@ -20,15 +20,15 @@
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module gvvksqgl.dll
// MVID: {50934C05-8B92-4905-A41A-146C5F2392BA}
.module oguadjyn.dll
// MVID: {7DE8C1A3-5051-43F6-ACDA-EFB9A52251C4}
.custom instance void [mscorlib]System.Security.UnverifiableCodeAttribute::.ctor() = ( 01 00 00 00 )
.imagebase 0x10000000
.file alignment 0x00000200
.stackreserve 0x00100000
.subsystem 0x0003 // WINDOWS_CUI
.corflags 0x00000001 // ILONLY
// Image base: 0x00410000
// Image base: 0x019F0000
// =============== CLASS MEMBERS DECLARATION ===================
@ -203,6 +203,7 @@ @@ -203,6 +203,7 @@
.field private int32[] array1
.field private valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/StructContainer field1
.field private valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MyEnum enumField
.field private valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/ShortEnum shortEnumField
.field public static int32 StaticField
.field public static int16 StaticShortField
.field private static int32 '<StaticProperty>k__BackingField'
@ -771,7 +772,7 @@ @@ -771,7 +772,7 @@
.method public hidebysig instance void
Enum() cil managed
{
// Code size 31 (0x1f)
// Code size 59 (0x3b)
.maxstack 8
IL_0000: nop
IL_0001: ldarg.0
@ -786,9 +787,58 @@ @@ -786,9 +787,58 @@
IL_0016: ldc.i4.s -5
IL_0018: and
IL_0019: stfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MyEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::enumField
IL_001e: ret
IL_001e: ldarg.0
IL_001f: dup
IL_0020: ldfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MyEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::enumField
IL_0025: ldc.i4.2
IL_0026: add
IL_0027: stfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MyEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::enumField
IL_002c: ldarg.0
IL_002d: dup
IL_002e: ldfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MyEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::enumField
IL_0033: ldc.i4.3
IL_0034: sub
IL_0035: stfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MyEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::enumField
IL_003a: ret
} // end of method CompoundAssignmentTest::Enum
.method public hidebysig instance void
ShortEnumTest() cil managed
{
// Code size 63 (0x3f)
.maxstack 8
IL_0000: nop
IL_0001: ldarg.0
IL_0002: dup
IL_0003: ldfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/ShortEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::shortEnumField
IL_0008: ldc.i4.2
IL_0009: or
IL_000a: conv.i2
IL_000b: stfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/ShortEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::shortEnumField
IL_0010: ldarg.0
IL_0011: dup
IL_0012: ldfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/ShortEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::shortEnumField
IL_0017: ldc.i4.s -5
IL_0019: and
IL_001a: conv.i2
IL_001b: stfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/ShortEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::shortEnumField
IL_0020: ldarg.0
IL_0021: dup
IL_0022: ldfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/ShortEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::shortEnumField
IL_0027: ldc.i4.2
IL_0028: add
IL_0029: conv.i2
IL_002a: stfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/ShortEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::shortEnumField
IL_002f: ldarg.0
IL_0030: dup
IL_0031: ldfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/ShortEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::shortEnumField
IL_0036: ldc.i4.3
IL_0037: sub
IL_0038: conv.i2
IL_0039: stfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/ShortEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::shortEnumField
IL_003e: ret
} // end of method CompoundAssignmentTest::ShortEnumTest
.method public hidebysig instance int32
PreIncrementInAddition(int32 i,
int32 j) cil managed
@ -883,8 +933,53 @@ @@ -883,8 +933,53 @@
IL_0015: ret
} // end of method CompoundAssignmentTest::IncrementArrayElement
.method public hidebysig instance void
DoubleArrayElement(int32[] 'array',
int32 pos) cil managed
{
// Code size 22 (0x16)
.maxstack 8
IL_0000: nop
IL_0001: ldarg.1
IL_0002: ldarg.2
IL_0003: ldelema [mscorlib]System.Int32
IL_0008: dup
IL_0009: ldobj [mscorlib]System.Int32
IL_000e: ldc.i4.2
IL_000f: mul
IL_0010: stobj [mscorlib]System.Int32
IL_0015: ret
} // end of method CompoundAssignmentTest::DoubleArrayElement
.method public hidebysig instance int32
PreIncrementShortArrayElement(int16[] 'array',
DoubleArrayElementAndReturn(int32[] 'array',
int32 pos) cil managed
{
// Code size 29 (0x1d)
.maxstack 3
.locals init (int32 V_0,
int32 V_1)
IL_0000: nop
IL_0001: ldarg.1
IL_0002: ldarg.2
IL_0003: ldelema [mscorlib]System.Int32
IL_0008: dup
IL_0009: ldobj [mscorlib]System.Int32
IL_000e: ldc.i4.2
IL_000f: mul
IL_0010: dup
IL_0011: stloc.1
IL_0012: stobj [mscorlib]System.Int32
IL_0017: ldloc.1
IL_0018: stloc.0
IL_0019: br.s IL_001b
IL_001b: ldloc.0
IL_001c: ret
} // end of method CompoundAssignmentTest::DoubleArrayElementAndReturn
.method public hidebysig instance int32
PreIncrementArrayElementShort(int16[] 'array',
int32 pos) cil managed
{
// Code size 30 (0x1e)
@ -909,10 +1004,10 @@ @@ -909,10 +1004,10 @@
IL_001c: ldloc.0
IL_001d: ret
} // end of method CompoundAssignmentTest::PreIncrementShortArrayElement
} // end of method CompoundAssignmentTest::PreIncrementArrayElementShort
.method public hidebysig instance int32
PostIncrementShortArrayElement(int16[] 'array',
PostIncrementArrayElementShort(int16[] 'array',
int32 pos) cil managed
{
// Code size 30 (0x1e)
@ -937,10 +1032,10 @@ @@ -937,10 +1032,10 @@
IL_001c: ldloc.0
IL_001d: ret
} // end of method CompoundAssignmentTest::PostIncrementShortArrayElement
} // end of method CompoundAssignmentTest::PostIncrementArrayElementShort
.method public hidebysig instance void
IncrementShortArrayElement(int16[] 'array',
IncrementArrayElementShort(int16[] 'array',
int32 pos) cil managed
{
// Code size 23 (0x17)
@ -956,7 +1051,54 @@ @@ -956,7 +1051,54 @@
IL_0010: conv.i2
IL_0011: stobj [mscorlib]System.Int16
IL_0016: ret
} // end of method CompoundAssignmentTest::IncrementShortArrayElement
} // end of method CompoundAssignmentTest::IncrementArrayElementShort
.method public hidebysig instance void
DoubleArrayElementShort(int16[] 'array',
int32 pos) cil managed
{
// Code size 23 (0x17)
.maxstack 8
IL_0000: nop
IL_0001: ldarg.1
IL_0002: ldarg.2
IL_0003: ldelema [mscorlib]System.Int16
IL_0008: dup
IL_0009: ldobj [mscorlib]System.Int16
IL_000e: ldc.i4.2
IL_000f: mul
IL_0010: conv.i2
IL_0011: stobj [mscorlib]System.Int16
IL_0016: ret
} // end of method CompoundAssignmentTest::DoubleArrayElementShort
.method public hidebysig instance int16
DoubleArrayElementShortAndReturn(int16[] 'array',
int32 pos) cil managed
{
// Code size 30 (0x1e)
.maxstack 3
.locals init (int16 V_0,
int16 V_1)
IL_0000: nop
IL_0001: ldarg.1
IL_0002: ldarg.2
IL_0003: ldelema [mscorlib]System.Int16
IL_0008: dup
IL_0009: ldobj [mscorlib]System.Int16
IL_000e: ldc.i4.2
IL_000f: mul
IL_0010: conv.i2
IL_0011: dup
IL_0012: stloc.1
IL_0013: stobj [mscorlib]System.Int16
IL_0018: ldloc.1
IL_0019: stloc.0
IL_001a: br.s IL_001c
IL_001c: ldloc.0
IL_001d: ret
} // end of method CompoundAssignmentTest::DoubleArrayElementShortAndReturn
.method public hidebysig instance int32
PreIncrementInstanceField() cil managed
@ -1024,6 +1166,47 @@ @@ -1024,6 +1166,47 @@
IL_0014: ret
} // end of method CompoundAssignmentTest::IncrementInstanceField
.method public hidebysig instance void
DoubleInstanceField() cil managed
{
// Code size 21 (0x15)
.maxstack 8
IL_0000: nop
IL_0001: ldarg.0
IL_0002: call instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::M()
IL_0007: dup
IL_0008: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::Field
IL_000d: ldc.i4.2
IL_000e: mul
IL_000f: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::Field
IL_0014: ret
} // end of method CompoundAssignmentTest::DoubleInstanceField
.method public hidebysig instance int32
DoubleInstanceFieldAndReturn() cil managed
{
// Code size 28 (0x1c)
.maxstack 3
.locals init (int32 V_0,
int32 V_1)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: call instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::M()
IL_0007: dup
IL_0008: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::Field
IL_000d: ldc.i4.2
IL_000e: mul
IL_000f: dup
IL_0010: stloc.1
IL_0011: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::Field
IL_0016: ldloc.1
IL_0017: stloc.0
IL_0018: br.s IL_001a
IL_001a: ldloc.0
IL_001b: ret
} // end of method CompoundAssignmentTest::DoubleInstanceFieldAndReturn
.method public hidebysig instance int32
PreIncrementInstanceField2(class ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass m) cil managed
{
@ -1225,6 +1408,49 @@ @@ -1225,6 +1408,49 @@
IL_0015: ret
} // end of method CompoundAssignmentTest::IncrementInstanceProperty
.method public hidebysig instance void
DoubleInstanceProperty() cil managed
{
// Code size 22 (0x16)
.maxstack 8
IL_0000: nop
IL_0001: ldarg.0
IL_0002: call instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::M()
IL_0007: dup
IL_0008: callvirt instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::get_Property()
IL_000d: ldc.i4.2
IL_000e: mul
IL_000f: callvirt instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::set_Property(int32)
IL_0014: nop
IL_0015: ret
} // end of method CompoundAssignmentTest::DoubleInstanceProperty
.method public hidebysig instance int32
DoubleInstancePropertyAndReturn() cil managed
{
// Code size 29 (0x1d)
.maxstack 3
.locals init (int32 V_0,
int32 V_1)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: call instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::M()
IL_0007: dup
IL_0008: callvirt instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::get_Property()
IL_000d: ldc.i4.2
IL_000e: mul
IL_000f: dup
IL_0010: stloc.1
IL_0011: callvirt instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::set_Property(int32)
IL_0016: nop
IL_0017: ldloc.1
IL_0018: stloc.0
IL_0019: br.s IL_001b
IL_001b: ldloc.0
IL_001c: ret
} // end of method CompoundAssignmentTest::DoubleInstancePropertyAndReturn
.method public hidebysig instance int32
PreIncrementInstancePropertyByte() cil managed
{
@ -1297,6 +1523,51 @@ @@ -1297,6 +1523,51 @@
IL_0016: ret
} // end of method CompoundAssignmentTest::IncrementInstancePropertyByte
.method public hidebysig instance void
DoubleInstancePropertyByte() cil managed
{
// Code size 23 (0x17)
.maxstack 8
IL_0000: nop
IL_0001: ldarg.0
IL_0002: call instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::M()
IL_0007: dup
IL_0008: callvirt instance uint8 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::get_ByteProperty()
IL_000d: ldc.i4.2
IL_000e: mul
IL_000f: conv.u1
IL_0010: callvirt instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::set_ByteProperty(uint8)
IL_0015: nop
IL_0016: ret
} // end of method CompoundAssignmentTest::DoubleInstancePropertyByte
.method public hidebysig instance int32
DoubleInstancePropertyByteAndReturn() cil managed
{
// Code size 30 (0x1e)
.maxstack 3
.locals init (int32 V_0,
uint8 V_1)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: call instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::M()
IL_0007: dup
IL_0008: callvirt instance uint8 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::get_ByteProperty()
IL_000d: ldc.i4.2
IL_000e: mul
IL_000f: conv.u1
IL_0010: dup
IL_0011: stloc.1
IL_0012: callvirt instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::set_ByteProperty(uint8)
IL_0017: nop
IL_0018: ldloc.1
IL_0019: stloc.0
IL_001a: br.s IL_001c
IL_001c: ldloc.0
IL_001d: ret
} // end of method CompoundAssignmentTest::DoubleInstancePropertyByteAndReturn
.method public hidebysig instance int32
PreIncrementStaticField() cil managed
{
@ -1348,6 +1619,38 @@ @@ -1348,6 +1619,38 @@
IL_000d: ret
} // end of method CompoundAssignmentTest::IncrementStaticField
.method public hidebysig instance void
DoubleStaticField() cil managed
{
// Code size 14 (0xe)
.maxstack 8
IL_0000: nop
IL_0001: ldsfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::StaticField
IL_0006: ldc.i4.2
IL_0007: mul
IL_0008: stsfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::StaticField
IL_000d: ret
} // end of method CompoundAssignmentTest::DoubleStaticField
.method public hidebysig instance int32
DoubleStaticFieldAndReturn() cil managed
{
// Code size 19 (0x13)
.maxstack 2
.locals init (int32 V_0)
IL_0000: nop
IL_0001: ldsfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::StaticField
IL_0006: ldc.i4.2
IL_0007: mul
IL_0008: dup
IL_0009: stsfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::StaticField
IL_000e: stloc.0
IL_000f: br.s IL_0011
IL_0011: ldloc.0
IL_0012: ret
} // end of method CompoundAssignmentTest::DoubleStaticFieldAndReturn
.method public hidebysig instance int32
PreIncrementStaticFieldShort() cil managed
{
@ -1402,6 +1705,40 @@ @@ -1402,6 +1705,40 @@
IL_000e: ret
} // end of method CompoundAssignmentTest::IncrementStaticFieldShort
.method public hidebysig instance void
DoubleStaticFieldShort() cil managed
{
// Code size 15 (0xf)
.maxstack 8
IL_0000: nop
IL_0001: ldsfld int16 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::StaticShortField
IL_0006: ldc.i4.2
IL_0007: mul
IL_0008: conv.i2
IL_0009: stsfld int16 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::StaticShortField
IL_000e: ret
} // end of method CompoundAssignmentTest::DoubleStaticFieldShort
.method public hidebysig instance int16
DoubleStaticFieldAndReturnShort() cil managed
{
// Code size 20 (0x14)
.maxstack 2
.locals init (int16 V_0)
IL_0000: nop
IL_0001: ldsfld int16 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::StaticShortField
IL_0006: ldc.i4.2
IL_0007: mul
IL_0008: conv.i2
IL_0009: dup
IL_000a: stsfld int16 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::StaticShortField
IL_000f: stloc.0
IL_0010: br.s IL_0012
IL_0012: ldloc.0
IL_0013: ret
} // end of method CompoundAssignmentTest::DoubleStaticFieldAndReturnShort
.method public hidebysig instance int32
PreIncrementStaticProperty() cil managed
{
@ -1456,6 +1793,40 @@ @@ -1456,6 +1793,40 @@
IL_000e: ret
} // end of method CompoundAssignmentTest::IncrementStaticProperty
.method public hidebysig instance void
DoubleStaticProperty() cil managed
{
// Code size 15 (0xf)
.maxstack 8
IL_0000: nop
IL_0001: call int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::get_StaticProperty()
IL_0006: ldc.i4.2
IL_0007: mul
IL_0008: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::set_StaticProperty(int32)
IL_000d: nop
IL_000e: ret
} // end of method CompoundAssignmentTest::DoubleStaticProperty
.method public hidebysig instance int32
DoubleStaticPropertyAndReturn() cil managed
{
// Code size 20 (0x14)
.maxstack 2
.locals init (int32 V_0)
IL_0000: nop
IL_0001: call int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::get_StaticProperty()
IL_0006: ldc.i4.2
IL_0007: mul
IL_0008: dup
IL_0009: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::set_StaticProperty(int32)
IL_000e: nop
IL_000f: stloc.0
IL_0010: br.s IL_0012
IL_0012: ldloc.0
IL_0013: ret
} // end of method CompoundAssignmentTest::DoubleStaticPropertyAndReturn
.method public hidebysig instance valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/ShortEnum
PreIncrementStaticPropertyShort() cil managed
{
@ -1547,7 +1918,7 @@ @@ -1547,7 +1918,7 @@
Issue954(valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MyEnum& a,
valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MyEnum b) cil managed
{
// Code size 8 (0x8)
// Code size 22 (0x16)
.maxstack 8
IL_0000: nop
IL_0001: ldarg.1
@ -1556,7 +1927,13 @@ @@ -1556,7 +1927,13 @@
IL_0004: ldarg.2
IL_0005: rem
IL_0006: stind.i4
IL_0007: ret
IL_0007: ldarg.0
IL_0008: ldarg.0
IL_0009: ldfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MyEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::enumField
IL_000e: ldarg.2
IL_000f: rem
IL_0010: stfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MyEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::enumField
IL_0015: ret
} // end of method CompoundAssignmentTest::Issue954
.method public hidebysig specialname rtspecialname

342
ICSharpCode.Decompiler.Tests/TestCases/Pretty/CompoundAssignmentTest.opt.il

@ -10,7 +10,7 @@ @@ -10,7 +10,7 @@
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly '20aqunvz'
.assembly vm2ov5l1
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 00 00 00 00 00 )
.custom instance void [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = ( 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx
@ -20,15 +20,15 @@ @@ -20,15 +20,15 @@
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module '20aqunvz.dll'
// MVID: {3A9D60C3-9668-4C33-85C8-329DB1EEECE6}
.module vm2ov5l1.dll
// MVID: {F7BCAA28-E619-40E7-921D-149FF48046FD}
.custom instance void [mscorlib]System.Security.UnverifiableCodeAttribute::.ctor() = ( 01 00 00 00 )
.imagebase 0x10000000
.file alignment 0x00000200
.stackreserve 0x00100000
.subsystem 0x0003 // WINDOWS_CUI
.corflags 0x00000001 // ILONLY
// Image base: 0x029E0000
// Image base: 0x052F0000
// =============== CLASS MEMBERS DECLARATION ===================
@ -186,6 +186,7 @@ @@ -186,6 +186,7 @@
.field private int32[] array1
.field private valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/StructContainer field1
.field private valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MyEnum enumField
.field private valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/ShortEnum shortEnumField
.field public static int32 StaticField
.field public static int16 StaticShortField
.field private static int32 '<StaticProperty>k__BackingField'
@ -659,7 +660,7 @@ @@ -659,7 +660,7 @@
.method public hidebysig instance void
Enum() cil managed
{
// Code size 30 (0x1e)
// Code size 58 (0x3a)
.maxstack 8
IL_0000: ldarg.0
IL_0001: dup
@ -673,9 +674,57 @@ @@ -673,9 +674,57 @@
IL_0015: ldc.i4.s -5
IL_0017: and
IL_0018: stfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MyEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::enumField
IL_001d: ret
IL_001d: ldarg.0
IL_001e: dup
IL_001f: ldfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MyEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::enumField
IL_0024: ldc.i4.2
IL_0025: add
IL_0026: stfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MyEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::enumField
IL_002b: ldarg.0
IL_002c: dup
IL_002d: ldfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MyEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::enumField
IL_0032: ldc.i4.3
IL_0033: sub
IL_0034: stfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MyEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::enumField
IL_0039: ret
} // end of method CompoundAssignmentTest::Enum
.method public hidebysig instance void
ShortEnumTest() cil managed
{
// Code size 62 (0x3e)
.maxstack 8
IL_0000: ldarg.0
IL_0001: dup
IL_0002: ldfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/ShortEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::shortEnumField
IL_0007: ldc.i4.2
IL_0008: or
IL_0009: conv.i2
IL_000a: stfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/ShortEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::shortEnumField
IL_000f: ldarg.0
IL_0010: dup
IL_0011: ldfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/ShortEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::shortEnumField
IL_0016: ldc.i4.s -5
IL_0018: and
IL_0019: conv.i2
IL_001a: stfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/ShortEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::shortEnumField
IL_001f: ldarg.0
IL_0020: dup
IL_0021: ldfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/ShortEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::shortEnumField
IL_0026: ldc.i4.2
IL_0027: add
IL_0028: conv.i2
IL_0029: stfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/ShortEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::shortEnumField
IL_002e: ldarg.0
IL_002f: dup
IL_0030: ldfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/ShortEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::shortEnumField
IL_0035: ldc.i4.3
IL_0036: sub
IL_0037: conv.i2
IL_0038: stfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/ShortEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::shortEnumField
IL_003d: ret
} // end of method CompoundAssignmentTest::ShortEnumTest
.method public hidebysig instance int32
PreIncrementInAddition(int32 i,
int32 j) cil managed
@ -751,8 +800,46 @@ @@ -751,8 +800,46 @@
IL_0014: ret
} // end of method CompoundAssignmentTest::IncrementArrayElement
.method public hidebysig instance void
DoubleArrayElement(int32[] 'array',
int32 pos) cil managed
{
// Code size 21 (0x15)
.maxstack 8
IL_0000: ldarg.1
IL_0001: ldarg.2
IL_0002: ldelema [mscorlib]System.Int32
IL_0007: dup
IL_0008: ldobj [mscorlib]System.Int32
IL_000d: ldc.i4.2
IL_000e: mul
IL_000f: stobj [mscorlib]System.Int32
IL_0014: ret
} // end of method CompoundAssignmentTest::DoubleArrayElement
.method public hidebysig instance int32
PreIncrementShortArrayElement(int16[] 'array',
DoubleArrayElementAndReturn(int32[] 'array',
int32 pos) cil managed
{
// Code size 24 (0x18)
.maxstack 3
.locals init (int32 V_0)
IL_0000: ldarg.1
IL_0001: ldarg.2
IL_0002: ldelema [mscorlib]System.Int32
IL_0007: dup
IL_0008: ldobj [mscorlib]System.Int32
IL_000d: ldc.i4.2
IL_000e: mul
IL_000f: dup
IL_0010: stloc.0
IL_0011: stobj [mscorlib]System.Int32
IL_0016: ldloc.0
IL_0017: ret
} // end of method CompoundAssignmentTest::DoubleArrayElementAndReturn
.method public hidebysig instance int32
PreIncrementArrayElementShort(int16[] 'array',
int32 pos) cil managed
{
// Code size 25 (0x19)
@ -771,10 +858,10 @@ @@ -771,10 +858,10 @@
IL_0012: stobj [mscorlib]System.Int16
IL_0017: ldloc.0
IL_0018: ret
} // end of method CompoundAssignmentTest::PreIncrementShortArrayElement
} // end of method CompoundAssignmentTest::PreIncrementArrayElementShort
.method public hidebysig instance int32
PostIncrementShortArrayElement(int16[] 'array',
PostIncrementArrayElementShort(int16[] 'array',
int32 pos) cil managed
{
// Code size 25 (0x19)
@ -793,10 +880,10 @@ @@ -793,10 +880,10 @@
IL_0012: stobj [mscorlib]System.Int16
IL_0017: ldloc.0
IL_0018: ret
} // end of method CompoundAssignmentTest::PostIncrementShortArrayElement
} // end of method CompoundAssignmentTest::PostIncrementArrayElementShort
.method public hidebysig instance void
IncrementShortArrayElement(int16[] 'array',
IncrementArrayElementShort(int16[] 'array',
int32 pos) cil managed
{
// Code size 22 (0x16)
@ -811,7 +898,47 @@ @@ -811,7 +898,47 @@
IL_000f: conv.i2
IL_0010: stobj [mscorlib]System.Int16
IL_0015: ret
} // end of method CompoundAssignmentTest::IncrementShortArrayElement
} // end of method CompoundAssignmentTest::IncrementArrayElementShort
.method public hidebysig instance void
DoubleArrayElementShort(int16[] 'array',
int32 pos) cil managed
{
// Code size 22 (0x16)
.maxstack 8
IL_0000: ldarg.1
IL_0001: ldarg.2
IL_0002: ldelema [mscorlib]System.Int16
IL_0007: dup
IL_0008: ldobj [mscorlib]System.Int16
IL_000d: ldc.i4.2
IL_000e: mul
IL_000f: conv.i2
IL_0010: stobj [mscorlib]System.Int16
IL_0015: ret
} // end of method CompoundAssignmentTest::DoubleArrayElementShort
.method public hidebysig instance int16
DoubleArrayElementShortAndReturn(int16[] 'array',
int32 pos) cil managed
{
// Code size 25 (0x19)
.maxstack 3
.locals init (int16 V_0)
IL_0000: ldarg.1
IL_0001: ldarg.2
IL_0002: ldelema [mscorlib]System.Int16
IL_0007: dup
IL_0008: ldobj [mscorlib]System.Int16
IL_000d: ldc.i4.2
IL_000e: mul
IL_000f: conv.i2
IL_0010: dup
IL_0011: stloc.0
IL_0012: stobj [mscorlib]System.Int16
IL_0017: ldloc.0
IL_0018: ret
} // end of method CompoundAssignmentTest::DoubleArrayElementShortAndReturn
.method public hidebysig instance int32
PreIncrementInstanceField() cil managed
@ -866,6 +993,40 @@ @@ -866,6 +993,40 @@
IL_0013: ret
} // end of method CompoundAssignmentTest::IncrementInstanceField
.method public hidebysig instance void
DoubleInstanceField() cil managed
{
// Code size 20 (0x14)
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::M()
IL_0006: dup
IL_0007: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::Field
IL_000c: ldc.i4.2
IL_000d: mul
IL_000e: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::Field
IL_0013: ret
} // end of method CompoundAssignmentTest::DoubleInstanceField
.method public hidebysig instance int32
DoubleInstanceFieldAndReturn() cil managed
{
// Code size 23 (0x17)
.maxstack 3
.locals init (int32 V_0)
IL_0000: ldarg.0
IL_0001: call instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::M()
IL_0006: dup
IL_0007: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::Field
IL_000c: ldc.i4.2
IL_000d: mul
IL_000e: dup
IL_000f: stloc.0
IL_0010: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::Field
IL_0015: ldloc.0
IL_0016: ret
} // end of method CompoundAssignmentTest::DoubleInstanceFieldAndReturn
.method public hidebysig instance int32
PreIncrementInstanceField2(class ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass m) cil managed
{
@ -1025,6 +1186,40 @@ @@ -1025,6 +1186,40 @@
IL_0013: ret
} // end of method CompoundAssignmentTest::IncrementInstanceProperty
.method public hidebysig instance void
DoubleInstanceProperty() cil managed
{
// Code size 20 (0x14)
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::M()
IL_0006: dup
IL_0007: callvirt instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::get_Property()
IL_000c: ldc.i4.2
IL_000d: mul
IL_000e: callvirt instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::set_Property(int32)
IL_0013: ret
} // end of method CompoundAssignmentTest::DoubleInstanceProperty
.method public hidebysig instance int32
DoubleInstancePropertyAndReturn() cil managed
{
// Code size 23 (0x17)
.maxstack 3
.locals init (int32 V_0)
IL_0000: ldarg.0
IL_0001: call instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::M()
IL_0006: dup
IL_0007: callvirt instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::get_Property()
IL_000c: ldc.i4.2
IL_000d: mul
IL_000e: dup
IL_000f: stloc.0
IL_0010: callvirt instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::set_Property(int32)
IL_0015: ldloc.0
IL_0016: ret
} // end of method CompoundAssignmentTest::DoubleInstancePropertyAndReturn
.method public hidebysig instance int32
PreIncrementInstancePropertyByte() cil managed
{
@ -1081,6 +1276,42 @@ @@ -1081,6 +1276,42 @@
IL_0014: ret
} // end of method CompoundAssignmentTest::IncrementInstancePropertyByte
.method public hidebysig instance void
DoubleInstancePropertyByte() cil managed
{
// Code size 21 (0x15)
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::M()
IL_0006: dup
IL_0007: callvirt instance uint8 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::get_ByteProperty()
IL_000c: ldc.i4.2
IL_000d: mul
IL_000e: conv.u1
IL_000f: callvirt instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::set_ByteProperty(uint8)
IL_0014: ret
} // end of method CompoundAssignmentTest::DoubleInstancePropertyByte
.method public hidebysig instance int32
DoubleInstancePropertyByteAndReturn() cil managed
{
// Code size 24 (0x18)
.maxstack 3
.locals init (uint8 V_0)
IL_0000: ldarg.0
IL_0001: call instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::M()
IL_0006: dup
IL_0007: callvirt instance uint8 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::get_ByteProperty()
IL_000c: ldc.i4.2
IL_000d: mul
IL_000e: conv.u1
IL_000f: dup
IL_0010: stloc.0
IL_0011: callvirt instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::set_ByteProperty(uint8)
IL_0016: ldloc.0
IL_0017: ret
} // end of method CompoundAssignmentTest::DoubleInstancePropertyByteAndReturn
.method public hidebysig instance int32
PreIncrementStaticField() cil managed
{
@ -1119,6 +1350,31 @@ @@ -1119,6 +1350,31 @@
IL_000c: ret
} // end of method CompoundAssignmentTest::IncrementStaticField
.method public hidebysig instance void
DoubleStaticField() cil managed
{
// Code size 13 (0xd)
.maxstack 8
IL_0000: ldsfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::StaticField
IL_0005: ldc.i4.2
IL_0006: mul
IL_0007: stsfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::StaticField
IL_000c: ret
} // end of method CompoundAssignmentTest::DoubleStaticField
.method public hidebysig instance int32
DoubleStaticFieldAndReturn() cil managed
{
// Code size 14 (0xe)
.maxstack 8
IL_0000: ldsfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::StaticField
IL_0005: ldc.i4.2
IL_0006: mul
IL_0007: dup
IL_0008: stsfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::StaticField
IL_000d: ret
} // end of method CompoundAssignmentTest::DoubleStaticFieldAndReturn
.method public hidebysig instance int32
PreIncrementStaticFieldShort() cil managed
{
@ -1160,6 +1416,33 @@ @@ -1160,6 +1416,33 @@
IL_000d: ret
} // end of method CompoundAssignmentTest::IncrementStaticFieldShort
.method public hidebysig instance void
DoubleStaticFieldShort() cil managed
{
// Code size 14 (0xe)
.maxstack 8
IL_0000: ldsfld int16 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::StaticShortField
IL_0005: ldc.i4.2
IL_0006: mul
IL_0007: conv.i2
IL_0008: stsfld int16 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::StaticShortField
IL_000d: ret
} // end of method CompoundAssignmentTest::DoubleStaticFieldShort
.method public hidebysig instance int16
DoubleStaticFieldAndReturnShort() cil managed
{
// Code size 15 (0xf)
.maxstack 8
IL_0000: ldsfld int16 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::StaticShortField
IL_0005: ldc.i4.2
IL_0006: mul
IL_0007: conv.i2
IL_0008: dup
IL_0009: stsfld int16 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::StaticShortField
IL_000e: ret
} // end of method CompoundAssignmentTest::DoubleStaticFieldAndReturnShort
.method public hidebysig instance int32
PreIncrementStaticProperty() cil managed
{
@ -1198,6 +1481,31 @@ @@ -1198,6 +1481,31 @@
IL_000c: ret
} // end of method CompoundAssignmentTest::IncrementStaticProperty
.method public hidebysig instance void
DoubleStaticProperty() cil managed
{
// Code size 13 (0xd)
.maxstack 8
IL_0000: call int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::get_StaticProperty()
IL_0005: ldc.i4.2
IL_0006: mul
IL_0007: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::set_StaticProperty(int32)
IL_000c: ret
} // end of method CompoundAssignmentTest::DoubleStaticProperty
.method public hidebysig instance int32
DoubleStaticPropertyAndReturn() cil managed
{
// Code size 14 (0xe)
.maxstack 8
IL_0000: call int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::get_StaticProperty()
IL_0005: ldc.i4.2
IL_0006: mul
IL_0007: dup
IL_0008: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::set_StaticProperty(int32)
IL_000d: ret
} // end of method CompoundAssignmentTest::DoubleStaticPropertyAndReturn
.method public hidebysig instance valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/ShortEnum
PreIncrementStaticPropertyShort() cil managed
{
@ -1266,7 +1574,7 @@ @@ -1266,7 +1574,7 @@
Issue954(valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MyEnum& a,
valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MyEnum b) cil managed
{
// Code size 7 (0x7)
// Code size 21 (0x15)
.maxstack 8
IL_0000: ldarg.1
IL_0001: ldarg.1
@ -1274,7 +1582,13 @@ @@ -1274,7 +1582,13 @@
IL_0003: ldarg.2
IL_0004: rem
IL_0005: stind.i4
IL_0006: ret
IL_0006: ldarg.0
IL_0007: ldarg.0
IL_0008: ldfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MyEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::enumField
IL_000d: ldarg.2
IL_000e: rem
IL_000f: stfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MyEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::enumField
IL_0014: ret
} // end of method CompoundAssignmentTest::Issue954
.method public hidebysig specialname rtspecialname

336
ICSharpCode.Decompiler.Tests/TestCases/Pretty/CompoundAssignmentTest.opt.roslyn.il

@ -25,14 +25,14 @@ @@ -25,14 +25,14 @@
.ver 0:0:0:0
}
.module CompoundAssignmentTest.dll
// MVID: {8664D95A-CCCF-4302-9678-AEB0491B7A00}
// MVID: {9C969BC5-E3E2-4944-BB85-4B7EAAE52E4D}
.custom instance void [mscorlib]System.Security.UnverifiableCodeAttribute::.ctor() = ( 01 00 00 00 )
.imagebase 0x10000000
.file alignment 0x00000200
.stackreserve 0x00100000
.subsystem 0x0003 // WINDOWS_CUI
.corflags 0x00000001 // ILONLY
// Image base: 0x02D20000
// Image base: 0x00480000
// =============== CLASS MEMBERS DECLARATION ===================
@ -190,6 +190,7 @@ @@ -190,6 +190,7 @@
.field private int32[] array1
.field private valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/StructContainer field1
.field private valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MyEnum enumField
.field private valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/ShortEnum shortEnumField
.field public static int32 StaticField
.field public static int16 StaticShortField
.field private static int32 '<StaticProperty>k__BackingField'
@ -662,7 +663,7 @@ @@ -662,7 +663,7 @@
.method public hidebysig instance void
Enum() cil managed
{
// Code size 30 (0x1e)
// Code size 58 (0x3a)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldarg.0
@ -676,9 +677,55 @@ @@ -676,9 +677,55 @@
IL_0015: ldc.i4.s -5
IL_0017: and
IL_0018: stfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MyEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::enumField
IL_001d: ret
IL_001d: ldarg.0
IL_001e: ldarg.0
IL_001f: ldfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MyEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::enumField
IL_0024: ldc.i4.2
IL_0025: add
IL_0026: stfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MyEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::enumField
IL_002b: ldarg.0
IL_002c: ldarg.0
IL_002d: ldfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MyEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::enumField
IL_0032: ldc.i4.3
IL_0033: sub
IL_0034: stfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MyEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::enumField
IL_0039: ret
} // end of method CompoundAssignmentTest::Enum
.method public hidebysig instance void
ShortEnumTest() cil managed
{
// Code size 60 (0x3c)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldarg.0
IL_0002: ldfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/ShortEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::shortEnumField
IL_0007: ldc.i4.2
IL_0008: or
IL_0009: stfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/ShortEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::shortEnumField
IL_000e: ldarg.0
IL_000f: ldarg.0
IL_0010: ldfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/ShortEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::shortEnumField
IL_0015: ldc.i4.s -5
IL_0017: and
IL_0018: stfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/ShortEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::shortEnumField
IL_001d: ldarg.0
IL_001e: ldarg.0
IL_001f: ldfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/ShortEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::shortEnumField
IL_0024: ldc.i4.2
IL_0025: add
IL_0026: conv.i2
IL_0027: stfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/ShortEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::shortEnumField
IL_002c: ldarg.0
IL_002d: ldarg.0
IL_002e: ldfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/ShortEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::shortEnumField
IL_0033: ldc.i4.3
IL_0034: sub
IL_0035: conv.i2
IL_0036: stfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/ShortEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::shortEnumField
IL_003b: ret
} // end of method CompoundAssignmentTest::ShortEnumTest
.method public hidebysig instance int32
PreIncrementInAddition(int32 i,
int32 j) cil managed
@ -754,8 +801,46 @@ @@ -754,8 +801,46 @@
IL_000c: ret
} // end of method CompoundAssignmentTest::IncrementArrayElement
.method public hidebysig instance void
DoubleArrayElement(int32[] 'array',
int32 pos) cil managed
{
// Code size 13 (0xd)
.maxstack 8
IL_0000: ldarg.1
IL_0001: ldarg.2
IL_0002: ldelema [mscorlib]System.Int32
IL_0007: dup
IL_0008: ldind.i4
IL_0009: ldc.i4.2
IL_000a: mul
IL_000b: stind.i4
IL_000c: ret
} // end of method CompoundAssignmentTest::DoubleArrayElement
.method public hidebysig instance int32
DoubleArrayElementAndReturn(int32[] 'array',
int32 pos) cil managed
{
// Code size 16 (0x10)
.maxstack 3
.locals init (int32 V_0)
IL_0000: ldarg.1
IL_0001: ldarg.2
IL_0002: ldelema [mscorlib]System.Int32
IL_0007: dup
IL_0008: ldind.i4
IL_0009: ldc.i4.2
IL_000a: mul
IL_000b: dup
IL_000c: stloc.0
IL_000d: stind.i4
IL_000e: ldloc.0
IL_000f: ret
} // end of method CompoundAssignmentTest::DoubleArrayElementAndReturn
.method public hidebysig instance int32
PreIncrementShortArrayElement(int16[] 'array',
PreIncrementArrayElementShort(int16[] 'array',
int32 pos) cil managed
{
// Code size 17 (0x11)
@ -774,10 +859,10 @@ @@ -774,10 +859,10 @@
IL_000e: stind.i2
IL_000f: ldloc.0
IL_0010: ret
} // end of method CompoundAssignmentTest::PreIncrementShortArrayElement
} // end of method CompoundAssignmentTest::PreIncrementArrayElementShort
.method public hidebysig instance int32
PostIncrementShortArrayElement(int16[] 'array',
PostIncrementArrayElementShort(int16[] 'array',
int32 pos) cil managed
{
// Code size 17 (0x11)
@ -796,10 +881,10 @@ @@ -796,10 +881,10 @@
IL_000e: stind.i2
IL_000f: ldloc.0
IL_0010: ret
} // end of method CompoundAssignmentTest::PostIncrementShortArrayElement
} // end of method CompoundAssignmentTest::PostIncrementArrayElementShort
.method public hidebysig instance void
IncrementShortArrayElement(int16[] 'array',
IncrementArrayElementShort(int16[] 'array',
int32 pos) cil managed
{
// Code size 14 (0xe)
@ -814,7 +899,47 @@ @@ -814,7 +899,47 @@
IL_000b: conv.i2
IL_000c: stind.i2
IL_000d: ret
} // end of method CompoundAssignmentTest::IncrementShortArrayElement
} // end of method CompoundAssignmentTest::IncrementArrayElementShort
.method public hidebysig instance void
DoubleArrayElementShort(int16[] 'array',
int32 pos) cil managed
{
// Code size 14 (0xe)
.maxstack 8
IL_0000: ldarg.1
IL_0001: ldarg.2
IL_0002: ldelema [mscorlib]System.Int16
IL_0007: dup
IL_0008: ldind.i2
IL_0009: ldc.i4.2
IL_000a: mul
IL_000b: conv.i2
IL_000c: stind.i2
IL_000d: ret
} // end of method CompoundAssignmentTest::DoubleArrayElementShort
.method public hidebysig instance int16
DoubleArrayElementShortAndReturn(int16[] 'array',
int32 pos) cil managed
{
// Code size 17 (0x11)
.maxstack 3
.locals init (int16 V_0)
IL_0000: ldarg.1
IL_0001: ldarg.2
IL_0002: ldelema [mscorlib]System.Int16
IL_0007: dup
IL_0008: ldind.i2
IL_0009: ldc.i4.2
IL_000a: mul
IL_000b: conv.i2
IL_000c: dup
IL_000d: stloc.0
IL_000e: stind.i2
IL_000f: ldloc.0
IL_0010: ret
} // end of method CompoundAssignmentTest::DoubleArrayElementShortAndReturn
.method public hidebysig instance int32
PreIncrementInstanceField() cil managed
@ -869,6 +994,40 @@ @@ -869,6 +994,40 @@
IL_0013: ret
} // end of method CompoundAssignmentTest::IncrementInstanceField
.method public hidebysig instance void
DoubleInstanceField() cil managed
{
// Code size 20 (0x14)
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::M()
IL_0006: dup
IL_0007: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::Field
IL_000c: ldc.i4.2
IL_000d: mul
IL_000e: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::Field
IL_0013: ret
} // end of method CompoundAssignmentTest::DoubleInstanceField
.method public hidebysig instance int32
DoubleInstanceFieldAndReturn() cil managed
{
// Code size 23 (0x17)
.maxstack 3
.locals init (int32 V_0)
IL_0000: ldarg.0
IL_0001: call instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::M()
IL_0006: dup
IL_0007: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::Field
IL_000c: ldc.i4.2
IL_000d: mul
IL_000e: dup
IL_000f: stloc.0
IL_0010: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::Field
IL_0015: ldloc.0
IL_0016: ret
} // end of method CompoundAssignmentTest::DoubleInstanceFieldAndReturn
.method public hidebysig instance int32
PreIncrementInstanceField2(class ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass m) cil managed
{
@ -1031,6 +1190,40 @@ @@ -1031,6 +1190,40 @@
IL_0015: ret
} // end of method CompoundAssignmentTest::IncrementInstanceProperty
.method public hidebysig instance void
DoubleInstanceProperty() cil managed
{
// Code size 20 (0x14)
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::M()
IL_0006: dup
IL_0007: callvirt instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::get_Property()
IL_000c: ldc.i4.2
IL_000d: mul
IL_000e: callvirt instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::set_Property(int32)
IL_0013: ret
} // end of method CompoundAssignmentTest::DoubleInstanceProperty
.method public hidebysig instance int32
DoubleInstancePropertyAndReturn() cil managed
{
// Code size 23 (0x17)
.maxstack 3
.locals init (int32 V_0)
IL_0000: ldarg.0
IL_0001: call instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::M()
IL_0006: dup
IL_0007: callvirt instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::get_Property()
IL_000c: ldc.i4.2
IL_000d: mul
IL_000e: dup
IL_000f: stloc.0
IL_0010: callvirt instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::set_Property(int32)
IL_0015: ldloc.0
IL_0016: ret
} // end of method CompoundAssignmentTest::DoubleInstancePropertyAndReturn
.method public hidebysig instance int32
PreIncrementInstancePropertyByte() cil managed
{
@ -1090,6 +1283,42 @@ @@ -1090,6 +1283,42 @@
IL_0016: ret
} // end of method CompoundAssignmentTest::IncrementInstancePropertyByte
.method public hidebysig instance void
DoubleInstancePropertyByte() cil managed
{
// Code size 21 (0x15)
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::M()
IL_0006: dup
IL_0007: callvirt instance uint8 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::get_ByteProperty()
IL_000c: ldc.i4.2
IL_000d: mul
IL_000e: conv.u1
IL_000f: callvirt instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::set_ByteProperty(uint8)
IL_0014: ret
} // end of method CompoundAssignmentTest::DoubleInstancePropertyByte
.method public hidebysig instance int32
DoubleInstancePropertyByteAndReturn() cil managed
{
// Code size 24 (0x18)
.maxstack 3
.locals init (uint8 V_0)
IL_0000: ldarg.0
IL_0001: call instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::M()
IL_0006: dup
IL_0007: callvirt instance uint8 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::get_ByteProperty()
IL_000c: ldc.i4.2
IL_000d: mul
IL_000e: conv.u1
IL_000f: dup
IL_0010: stloc.0
IL_0011: callvirt instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::set_ByteProperty(uint8)
IL_0016: ldloc.0
IL_0017: ret
} // end of method CompoundAssignmentTest::DoubleInstancePropertyByteAndReturn
.method public hidebysig instance int32
PreIncrementStaticField() cil managed
{
@ -1128,6 +1357,31 @@ @@ -1128,6 +1357,31 @@
IL_000c: ret
} // end of method CompoundAssignmentTest::IncrementStaticField
.method public hidebysig instance void
DoubleStaticField() cil managed
{
// Code size 13 (0xd)
.maxstack 8
IL_0000: ldsfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::StaticField
IL_0005: ldc.i4.2
IL_0006: mul
IL_0007: stsfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::StaticField
IL_000c: ret
} // end of method CompoundAssignmentTest::DoubleStaticField
.method public hidebysig instance int32
DoubleStaticFieldAndReturn() cil managed
{
// Code size 14 (0xe)
.maxstack 8
IL_0000: ldsfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::StaticField
IL_0005: ldc.i4.2
IL_0006: mul
IL_0007: dup
IL_0008: stsfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::StaticField
IL_000d: ret
} // end of method CompoundAssignmentTest::DoubleStaticFieldAndReturn
.method public hidebysig instance int32
PreIncrementStaticFieldShort() cil managed
{
@ -1169,6 +1423,33 @@ @@ -1169,6 +1423,33 @@
IL_000d: ret
} // end of method CompoundAssignmentTest::IncrementStaticFieldShort
.method public hidebysig instance void
DoubleStaticFieldShort() cil managed
{
// Code size 14 (0xe)
.maxstack 8
IL_0000: ldsfld int16 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::StaticShortField
IL_0005: ldc.i4.2
IL_0006: mul
IL_0007: conv.i2
IL_0008: stsfld int16 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::StaticShortField
IL_000d: ret
} // end of method CompoundAssignmentTest::DoubleStaticFieldShort
.method public hidebysig instance int16
DoubleStaticFieldAndReturnShort() cil managed
{
// Code size 15 (0xf)
.maxstack 8
IL_0000: ldsfld int16 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::StaticShortField
IL_0005: ldc.i4.2
IL_0006: mul
IL_0007: conv.i2
IL_0008: dup
IL_0009: stsfld int16 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::StaticShortField
IL_000e: ret
} // end of method CompoundAssignmentTest::DoubleStaticFieldAndReturnShort
.method public hidebysig instance int32
PreIncrementStaticProperty() cil managed
{
@ -1207,6 +1488,31 @@ @@ -1207,6 +1488,31 @@
IL_000c: ret
} // end of method CompoundAssignmentTest::IncrementStaticProperty
.method public hidebysig instance void
DoubleStaticProperty() cil managed
{
// Code size 13 (0xd)
.maxstack 8
IL_0000: call int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::get_StaticProperty()
IL_0005: ldc.i4.2
IL_0006: mul
IL_0007: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::set_StaticProperty(int32)
IL_000c: ret
} // end of method CompoundAssignmentTest::DoubleStaticProperty
.method public hidebysig instance int32
DoubleStaticPropertyAndReturn() cil managed
{
// Code size 14 (0xe)
.maxstack 8
IL_0000: call int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::get_StaticProperty()
IL_0005: ldc.i4.2
IL_0006: mul
IL_0007: dup
IL_0008: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::set_StaticProperty(int32)
IL_000d: ret
} // end of method CompoundAssignmentTest::DoubleStaticPropertyAndReturn
.method public hidebysig instance valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/ShortEnum
PreIncrementStaticPropertyShort() cil managed
{
@ -1272,7 +1578,7 @@ @@ -1272,7 +1578,7 @@
Issue954(valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MyEnum& a,
valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MyEnum b) cil managed
{
// Code size 7 (0x7)
// Code size 21 (0x15)
.maxstack 8
IL_0000: ldarg.1
IL_0001: ldarg.1
@ -1280,7 +1586,13 @@ @@ -1280,7 +1586,13 @@
IL_0003: ldarg.2
IL_0004: rem
IL_0005: stind.i4
IL_0006: ret
IL_0006: ldarg.0
IL_0007: ldarg.0
IL_0008: ldfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MyEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::enumField
IL_000d: ldarg.2
IL_000e: rem
IL_000f: stfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MyEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::enumField
IL_0014: ret
} // end of method CompoundAssignmentTest::Issue954
.method public hidebysig specialname rtspecialname

399
ICSharpCode.Decompiler.Tests/TestCases/Pretty/CompoundAssignmentTest.roslyn.il

@ -25,14 +25,14 @@ @@ -25,14 +25,14 @@
.ver 0:0:0:0
}
.module CompoundAssignmentTest.dll
// MVID: {9D118C00-E9E9-446E-9B2F-0C32732A9171}
// MVID: {AB7EC3EB-B732-497E-809B-7D4DBB442E2C}
.custom instance void [mscorlib]System.Security.UnverifiableCodeAttribute::.ctor() = ( 01 00 00 00 )
.imagebase 0x10000000
.file alignment 0x00000200
.stackreserve 0x00100000
.subsystem 0x0003 // WINDOWS_CUI
.corflags 0x00000001 // ILONLY
// Image base: 0x02BF0000
// Image base: 0x019F0000
// =============== CLASS MEMBERS DECLARATION ===================
@ -201,6 +201,7 @@ @@ -201,6 +201,7 @@
.field private int32[] array1
.field private valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/StructContainer field1
.field private valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MyEnum enumField
.field private valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/ShortEnum shortEnumField
.field public static int32 StaticField
.field public static int16 StaticShortField
.field private static int32 '<StaticProperty>k__BackingField'
@ -760,7 +761,7 @@ @@ -760,7 +761,7 @@
.method public hidebysig instance void
Enum() cil managed
{
// Code size 31 (0x1f)
// Code size 59 (0x3b)
.maxstack 8
IL_0000: nop
IL_0001: ldarg.0
@ -775,9 +776,56 @@ @@ -775,9 +776,56 @@
IL_0016: ldc.i4.s -5
IL_0018: and
IL_0019: stfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MyEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::enumField
IL_001e: ret
IL_001e: ldarg.0
IL_001f: ldarg.0
IL_0020: ldfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MyEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::enumField
IL_0025: ldc.i4.2
IL_0026: add
IL_0027: stfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MyEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::enumField
IL_002c: ldarg.0
IL_002d: ldarg.0
IL_002e: ldfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MyEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::enumField
IL_0033: ldc.i4.3
IL_0034: sub
IL_0035: stfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MyEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::enumField
IL_003a: ret
} // end of method CompoundAssignmentTest::Enum
.method public hidebysig instance void
ShortEnumTest() cil managed
{
// Code size 61 (0x3d)
.maxstack 8
IL_0000: nop
IL_0001: ldarg.0
IL_0002: ldarg.0
IL_0003: ldfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/ShortEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::shortEnumField
IL_0008: ldc.i4.2
IL_0009: or
IL_000a: stfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/ShortEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::shortEnumField
IL_000f: ldarg.0
IL_0010: ldarg.0
IL_0011: ldfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/ShortEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::shortEnumField
IL_0016: ldc.i4.s -5
IL_0018: and
IL_0019: stfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/ShortEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::shortEnumField
IL_001e: ldarg.0
IL_001f: ldarg.0
IL_0020: ldfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/ShortEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::shortEnumField
IL_0025: ldc.i4.2
IL_0026: add
IL_0027: conv.i2
IL_0028: stfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/ShortEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::shortEnumField
IL_002d: ldarg.0
IL_002e: ldarg.0
IL_002f: ldfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/ShortEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::shortEnumField
IL_0034: ldc.i4.3
IL_0035: sub
IL_0036: conv.i2
IL_0037: stfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/ShortEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::shortEnumField
IL_003c: ret
} // end of method CompoundAssignmentTest::ShortEnumTest
.method public hidebysig instance int32
PreIncrementInAddition(int32 i,
int32 j) cil managed
@ -872,8 +920,53 @@ @@ -872,8 +920,53 @@
IL_000d: ret
} // end of method CompoundAssignmentTest::IncrementArrayElement
.method public hidebysig instance void
DoubleArrayElement(int32[] 'array',
int32 pos) cil managed
{
// Code size 14 (0xe)
.maxstack 8
IL_0000: nop
IL_0001: ldarg.1
IL_0002: ldarg.2
IL_0003: ldelema [mscorlib]System.Int32
IL_0008: dup
IL_0009: ldind.i4
IL_000a: ldc.i4.2
IL_000b: mul
IL_000c: stind.i4
IL_000d: ret
} // end of method CompoundAssignmentTest::DoubleArrayElement
.method public hidebysig instance int32
PreIncrementShortArrayElement(int16[] 'array',
DoubleArrayElementAndReturn(int32[] 'array',
int32 pos) cil managed
{
// Code size 21 (0x15)
.maxstack 3
.locals init (int32 V_0,
int32 V_1)
IL_0000: nop
IL_0001: ldarg.1
IL_0002: ldarg.2
IL_0003: ldelema [mscorlib]System.Int32
IL_0008: dup
IL_0009: ldind.i4
IL_000a: ldc.i4.2
IL_000b: mul
IL_000c: dup
IL_000d: stloc.0
IL_000e: stind.i4
IL_000f: ldloc.0
IL_0010: stloc.1
IL_0011: br.s IL_0013
IL_0013: ldloc.1
IL_0014: ret
} // end of method CompoundAssignmentTest::DoubleArrayElementAndReturn
.method public hidebysig instance int32
PreIncrementArrayElementShort(int16[] 'array',
int32 pos) cil managed
{
// Code size 22 (0x16)
@ -898,10 +991,10 @@ @@ -898,10 +991,10 @@
IL_0014: ldloc.1
IL_0015: ret
} // end of method CompoundAssignmentTest::PreIncrementShortArrayElement
} // end of method CompoundAssignmentTest::PreIncrementArrayElementShort
.method public hidebysig instance int32
PostIncrementShortArrayElement(int16[] 'array',
PostIncrementArrayElementShort(int16[] 'array',
int32 pos) cil managed
{
// Code size 22 (0x16)
@ -926,10 +1019,10 @@ @@ -926,10 +1019,10 @@
IL_0014: ldloc.1
IL_0015: ret
} // end of method CompoundAssignmentTest::PostIncrementShortArrayElement
} // end of method CompoundAssignmentTest::PostIncrementArrayElementShort
.method public hidebysig instance void
IncrementShortArrayElement(int16[] 'array',
IncrementArrayElementShort(int16[] 'array',
int32 pos) cil managed
{
// Code size 15 (0xf)
@ -945,7 +1038,54 @@ @@ -945,7 +1038,54 @@
IL_000c: conv.i2
IL_000d: stind.i2
IL_000e: ret
} // end of method CompoundAssignmentTest::IncrementShortArrayElement
} // end of method CompoundAssignmentTest::IncrementArrayElementShort
.method public hidebysig instance void
DoubleArrayElementShort(int16[] 'array',
int32 pos) cil managed
{
// Code size 15 (0xf)
.maxstack 8
IL_0000: nop
IL_0001: ldarg.1
IL_0002: ldarg.2
IL_0003: ldelema [mscorlib]System.Int16
IL_0008: dup
IL_0009: ldind.i2
IL_000a: ldc.i4.2
IL_000b: mul
IL_000c: conv.i2
IL_000d: stind.i2
IL_000e: ret
} // end of method CompoundAssignmentTest::DoubleArrayElementShort
.method public hidebysig instance int16
DoubleArrayElementShortAndReturn(int16[] 'array',
int32 pos) cil managed
{
// Code size 22 (0x16)
.maxstack 3
.locals init (int16 V_0,
int16 V_1)
IL_0000: nop
IL_0001: ldarg.1
IL_0002: ldarg.2
IL_0003: ldelema [mscorlib]System.Int16
IL_0008: dup
IL_0009: ldind.i2
IL_000a: ldc.i4.2
IL_000b: mul
IL_000c: conv.i2
IL_000d: dup
IL_000e: stloc.0
IL_000f: stind.i2
IL_0010: ldloc.0
IL_0011: stloc.1
IL_0012: br.s IL_0014
IL_0014: ldloc.1
IL_0015: ret
} // end of method CompoundAssignmentTest::DoubleArrayElementShortAndReturn
.method public hidebysig instance int32
PreIncrementInstanceField() cil managed
@ -1013,6 +1153,47 @@ @@ -1013,6 +1153,47 @@
IL_0014: ret
} // end of method CompoundAssignmentTest::IncrementInstanceField
.method public hidebysig instance void
DoubleInstanceField() cil managed
{
// Code size 21 (0x15)
.maxstack 8
IL_0000: nop
IL_0001: ldarg.0
IL_0002: call instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::M()
IL_0007: dup
IL_0008: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::Field
IL_000d: ldc.i4.2
IL_000e: mul
IL_000f: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::Field
IL_0014: ret
} // end of method CompoundAssignmentTest::DoubleInstanceField
.method public hidebysig instance int32
DoubleInstanceFieldAndReturn() cil managed
{
// Code size 28 (0x1c)
.maxstack 3
.locals init (int32 V_0,
int32 V_1)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: call instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::M()
IL_0007: dup
IL_0008: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::Field
IL_000d: ldc.i4.2
IL_000e: mul
IL_000f: dup
IL_0010: stloc.0
IL_0011: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::Field
IL_0016: ldloc.0
IL_0017: stloc.1
IL_0018: br.s IL_001a
IL_001a: ldloc.1
IL_001b: ret
} // end of method CompoundAssignmentTest::DoubleInstanceFieldAndReturn
.method public hidebysig instance int32
PreIncrementInstanceField2(class ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass m) cil managed
{
@ -1217,6 +1398,49 @@ @@ -1217,6 +1398,49 @@
IL_0017: ret
} // end of method CompoundAssignmentTest::IncrementInstanceProperty
.method public hidebysig instance void
DoubleInstanceProperty() cil managed
{
// Code size 22 (0x16)
.maxstack 8
IL_0000: nop
IL_0001: ldarg.0
IL_0002: call instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::M()
IL_0007: dup
IL_0008: callvirt instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::get_Property()
IL_000d: ldc.i4.2
IL_000e: mul
IL_000f: callvirt instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::set_Property(int32)
IL_0014: nop
IL_0015: ret
} // end of method CompoundAssignmentTest::DoubleInstanceProperty
.method public hidebysig instance int32
DoubleInstancePropertyAndReturn() cil managed
{
// Code size 29 (0x1d)
.maxstack 3
.locals init (int32 V_0,
int32 V_1)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: call instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::M()
IL_0007: dup
IL_0008: callvirt instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::get_Property()
IL_000d: ldc.i4.2
IL_000e: mul
IL_000f: dup
IL_0010: stloc.0
IL_0011: callvirt instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::set_Property(int32)
IL_0016: nop
IL_0017: ldloc.0
IL_0018: stloc.1
IL_0019: br.s IL_001b
IL_001b: ldloc.1
IL_001c: ret
} // end of method CompoundAssignmentTest::DoubleInstancePropertyAndReturn
.method public hidebysig instance int32
PreIncrementInstancePropertyByte() cil managed
{
@ -1292,6 +1516,51 @@ @@ -1292,6 +1516,51 @@
IL_0018: ret
} // end of method CompoundAssignmentTest::IncrementInstancePropertyByte
.method public hidebysig instance void
DoubleInstancePropertyByte() cil managed
{
// Code size 23 (0x17)
.maxstack 8
IL_0000: nop
IL_0001: ldarg.0
IL_0002: call instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::M()
IL_0007: dup
IL_0008: callvirt instance uint8 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::get_ByteProperty()
IL_000d: ldc.i4.2
IL_000e: mul
IL_000f: conv.u1
IL_0010: callvirt instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::set_ByteProperty(uint8)
IL_0015: nop
IL_0016: ret
} // end of method CompoundAssignmentTest::DoubleInstancePropertyByte
.method public hidebysig instance int32
DoubleInstancePropertyByteAndReturn() cil managed
{
// Code size 30 (0x1e)
.maxstack 3
.locals init (uint8 V_0,
int32 V_1)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: call instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::M()
IL_0007: dup
IL_0008: callvirt instance uint8 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::get_ByteProperty()
IL_000d: ldc.i4.2
IL_000e: mul
IL_000f: conv.u1
IL_0010: dup
IL_0011: stloc.0
IL_0012: callvirt instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::set_ByteProperty(uint8)
IL_0017: nop
IL_0018: ldloc.0
IL_0019: stloc.1
IL_001a: br.s IL_001c
IL_001c: ldloc.1
IL_001d: ret
} // end of method CompoundAssignmentTest::DoubleInstancePropertyByteAndReturn
.method public hidebysig instance int32
PreIncrementStaticField() cil managed
{
@ -1343,6 +1612,38 @@ @@ -1343,6 +1612,38 @@
IL_000d: ret
} // end of method CompoundAssignmentTest::IncrementStaticField
.method public hidebysig instance void
DoubleStaticField() cil managed
{
// Code size 14 (0xe)
.maxstack 8
IL_0000: nop
IL_0001: ldsfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::StaticField
IL_0006: ldc.i4.2
IL_0007: mul
IL_0008: stsfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::StaticField
IL_000d: ret
} // end of method CompoundAssignmentTest::DoubleStaticField
.method public hidebysig instance int32
DoubleStaticFieldAndReturn() cil managed
{
// Code size 19 (0x13)
.maxstack 2
.locals init (int32 V_0)
IL_0000: nop
IL_0001: ldsfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::StaticField
IL_0006: ldc.i4.2
IL_0007: mul
IL_0008: dup
IL_0009: stsfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::StaticField
IL_000e: stloc.0
IL_000f: br.s IL_0011
IL_0011: ldloc.0
IL_0012: ret
} // end of method CompoundAssignmentTest::DoubleStaticFieldAndReturn
.method public hidebysig instance int32
PreIncrementStaticFieldShort() cil managed
{
@ -1397,6 +1698,40 @@ @@ -1397,6 +1698,40 @@
IL_000e: ret
} // end of method CompoundAssignmentTest::IncrementStaticFieldShort
.method public hidebysig instance void
DoubleStaticFieldShort() cil managed
{
// Code size 15 (0xf)
.maxstack 8
IL_0000: nop
IL_0001: ldsfld int16 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::StaticShortField
IL_0006: ldc.i4.2
IL_0007: mul
IL_0008: conv.i2
IL_0009: stsfld int16 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::StaticShortField
IL_000e: ret
} // end of method CompoundAssignmentTest::DoubleStaticFieldShort
.method public hidebysig instance int16
DoubleStaticFieldAndReturnShort() cil managed
{
// Code size 20 (0x14)
.maxstack 2
.locals init (int16 V_0)
IL_0000: nop
IL_0001: ldsfld int16 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::StaticShortField
IL_0006: ldc.i4.2
IL_0007: mul
IL_0008: conv.i2
IL_0009: dup
IL_000a: stsfld int16 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::StaticShortField
IL_000f: stloc.0
IL_0010: br.s IL_0012
IL_0012: ldloc.0
IL_0013: ret
} // end of method CompoundAssignmentTest::DoubleStaticFieldAndReturnShort
.method public hidebysig instance int32
PreIncrementStaticProperty() cil managed
{
@ -1451,6 +1786,40 @@ @@ -1451,6 +1786,40 @@
IL_000e: ret
} // end of method CompoundAssignmentTest::IncrementStaticProperty
.method public hidebysig instance void
DoubleStaticProperty() cil managed
{
// Code size 15 (0xf)
.maxstack 8
IL_0000: nop
IL_0001: call int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::get_StaticProperty()
IL_0006: ldc.i4.2
IL_0007: mul
IL_0008: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::set_StaticProperty(int32)
IL_000d: nop
IL_000e: ret
} // end of method CompoundAssignmentTest::DoubleStaticProperty
.method public hidebysig instance int32
DoubleStaticPropertyAndReturn() cil managed
{
// Code size 20 (0x14)
.maxstack 2
.locals init (int32 V_0)
IL_0000: nop
IL_0001: call int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::get_StaticProperty()
IL_0006: ldc.i4.2
IL_0007: mul
IL_0008: dup
IL_0009: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::set_StaticProperty(int32)
IL_000e: nop
IL_000f: stloc.0
IL_0010: br.s IL_0012
IL_0012: ldloc.0
IL_0013: ret
} // end of method CompoundAssignmentTest::DoubleStaticPropertyAndReturn
.method public hidebysig instance valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/ShortEnum
PreIncrementStaticPropertyShort() cil managed
{
@ -1542,7 +1911,7 @@ @@ -1542,7 +1911,7 @@
Issue954(valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MyEnum& a,
valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MyEnum b) cil managed
{
// Code size 8 (0x8)
// Code size 22 (0x16)
.maxstack 8
IL_0000: nop
IL_0001: ldarg.1
@ -1551,7 +1920,13 @@ @@ -1551,7 +1920,13 @@
IL_0004: ldarg.2
IL_0005: rem
IL_0006: stind.i4
IL_0007: ret
IL_0007: ldarg.0
IL_0008: ldarg.0
IL_0009: ldfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MyEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::enumField
IL_000e: ldarg.2
IL_000f: rem
IL_0010: stfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MyEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::enumField
IL_0015: ret
} // end of method CompoundAssignmentTest::Issue954
.method public hidebysig specialname rtspecialname

4
ICSharpCode.Decompiler/CSharp/ExpressionBuilder.cs

@ -1078,7 +1078,7 @@ namespace ICSharpCode.Decompiler.CSharp @@ -1078,7 +1078,7 @@ namespace ICSharpCode.Decompiler.CSharp
if (NullableType.IsNullable(value.Type)) {
targetType = NullableType.Create(compilation, targetType);
}
value = value.ConvertTo(targetType, this, inst.CheckForOverflow);
value = value.ConvertTo(targetType, this, inst.CheckForOverflow, allowImplicitConversion: true);
break;
}
case AssignmentOperatorType.Multiply:
@ -1091,7 +1091,7 @@ namespace ICSharpCode.Decompiler.CSharp @@ -1091,7 +1091,7 @@ namespace ICSharpCode.Decompiler.CSharp
if (NullableType.IsNullable(value.Type)) {
targetType = NullableType.Create(compilation, targetType);
}
value = value.ConvertTo(targetType, this, inst.CheckForOverflow);
value = value.ConvertTo(targetType, this, inst.CheckForOverflow, allowImplicitConversion: true);
break;
}
}

8
ICSharpCode.Decompiler/IL/Instructions.cs

@ -94,7 +94,7 @@ namespace ICSharpCode.Decompiler.IL @@ -94,7 +94,7 @@ namespace ICSharpCode.Decompiler.IL
/// <summary>Loads the address of a local variable. (ldarga/ldloca)</summary>
LdLoca,
/// <summary>Stores a value into a local variable. (IL: starg/stloc)
/// Evaluates to the value that was stored (for byte/short variables: evaluates to the truncated value)</summary>
/// Evaluates to the value that was stored (for byte/short variables: evaluates to the truncated value, sign/zero extended back to I4 based on variable.Type.GetSign())</summary>
StLoc,
/// <summary>Stores the value into an anonymous temporary variable, and returns the address of that variable.</summary>
AddressOf,
@ -139,7 +139,7 @@ namespace ICSharpCode.Decompiler.IL @@ -139,7 +139,7 @@ namespace ICSharpCode.Decompiler.IL
/// <summary>Indirect load (ref/pointer dereference).</summary>
LdObj,
/// <summary>Indirect store (store to ref/pointer).
/// Evaluates to the value that was stored (when using type byte/short: evaluates to the truncated value)</summary>
/// Evaluates to the value that was stored (when using type byte/short: evaluates to the truncated value, sign/zero extended back to I4 based on type.GetSign())</summary>
StObj,
/// <summary>Boxes a value.</summary>
Box,
@ -2223,7 +2223,7 @@ namespace ICSharpCode.Decompiler.IL @@ -2223,7 +2223,7 @@ namespace ICSharpCode.Decompiler.IL
namespace ICSharpCode.Decompiler.IL
{
/// <summary>Stores a value into a local variable. (IL: starg/stloc)
/// Evaluates to the value that was stored (for byte/short variables: evaluates to the truncated value)</summary>
/// Evaluates to the value that was stored (for byte/short variables: evaluates to the truncated value, sign/zero extended back to I4 based on variable.Type.GetSign())</summary>
public sealed partial class StLoc : ILInstruction, IStoreInstruction
{
public StLoc(ILVariable variable, ILInstruction value) : base(OpCode.StLoc)
@ -3559,7 +3559,7 @@ namespace ICSharpCode.Decompiler.IL @@ -3559,7 +3559,7 @@ namespace ICSharpCode.Decompiler.IL
namespace ICSharpCode.Decompiler.IL
{
/// <summary>Indirect store (store to ref/pointer).
/// Evaluates to the value that was stored (when using type byte/short: evaluates to the truncated value)</summary>
/// Evaluates to the value that was stored (when using type byte/short: evaluates to the truncated value, sign/zero extended back to I4 based on type.GetSign())</summary>
public sealed partial class StObj : ILInstruction, ISupportsVolatilePrefix, ISupportsUnalignedPrefix
{
public StObj(ILInstruction target, ILInstruction value, IType type) : base(OpCode.StObj)

4
ICSharpCode.Decompiler/IL/Instructions.tt

@ -151,7 +151,7 @@ @@ -151,7 +151,7 @@
new OpCode("ldloca", "Loads the address of a local variable. (ldarga/ldloca)",
CustomClassName("LdLoca"), NoArguments, ResultType("Ref"), HasVariableOperand("Address")),
new OpCode("stloc", "Stores a value into a local variable. (IL: starg/stloc)" + Environment.NewLine
+ "Evaluates to the value that was stored (for byte/short variables: evaluates to the truncated value)",
+ "Evaluates to the value that was stored (for byte/short variables: evaluates to the truncated value, sign/zero extended back to I4 based on variable.Type.GetSign())",
CustomClassName("StLoc"), HasVariableOperand("Store"), CustomArguments("value"),
ResultType("variable.StackType")),
new OpCode("addressof", "Stores the value into an anonymous temporary variable, and returns the address of that variable.",
@ -206,7 +206,7 @@ @@ -206,7 +206,7 @@
CustomClassName("LdObj"), CustomArguments("target"), HasTypeOperand, MemoryAccess, CustomWriteToButKeepOriginal,
SupportsVolatilePrefix, SupportsUnalignedPrefix, MayThrow, ResultType("type.GetStackType()")),
new OpCode("stobj", "Indirect store (store to ref/pointer)." + Environment.NewLine
+ "Evaluates to the value that was stored (when using type byte/short: evaluates to the truncated value)",
+ "Evaluates to the value that was stored (when using type byte/short: evaluates to the truncated value, sign/zero extended back to I4 based on type.GetSign())",
CustomClassName("StObj"), CustomArguments("target", "value"), HasTypeOperand, MemoryAccess, CustomWriteToButKeepOriginal,
SupportsVolatilePrefix, SupportsUnalignedPrefix, MayThrow, ResultType("type.GetStackType()")),

12
ICSharpCode.Decompiler/IL/Instructions/CompoundAssignmentInstruction.cs

@ -86,8 +86,16 @@ namespace ICSharpCode.Decompiler.IL @@ -86,8 +86,16 @@ namespace ICSharpCode.Decompiler.IL
type = NullableType.GetUnderlyingType(type);
}
if (type.Kind == TypeKind.Enum) {
if (binary.Operator != BinaryNumericOperator.Add && binary.Operator != BinaryNumericOperator.Sub)
return false;
switch (binary.Operator) {
case BinaryNumericOperator.Add:
case BinaryNumericOperator.Sub:
case BinaryNumericOperator.BitAnd:
case BinaryNumericOperator.BitOr:
case BinaryNumericOperator.BitXor:
break; // OK
default:
return false; // operator not supported on enum types
}
}
if (binary.Sign != Sign.None) {
if (type.GetSign() != binary.Sign)

27
ICSharpCode.Decompiler/IL/Transforms/ExpressionTransforms.cs

@ -279,32 +279,7 @@ namespace ICSharpCode.Decompiler.IL.Transforms @@ -279,32 +279,7 @@ namespace ICSharpCode.Decompiler.IL.Transforms
context.RequestRerun();
return;
}
if (inst.Value is BinaryNumericInstruction binary
&& binary.Left is LdObj ldobj
&& inst.Target.Match(ldobj.Target).Success
&& SemanticHelper.IsPure(ldobj.Target.Flags))
{
// ldobj.Type may just be 'int' (due to ldind.i4) when we're actually operating on a 'ref MyEnum'.
// Try to determine the real type of the object we're modifying:
IType targetType = ldobj.Target.InferType();
if (targetType.Kind == TypeKind.Pointer || targetType.Kind == TypeKind.ByReference) {
targetType = ((TypeWithElementType)targetType).ElementType;
if (targetType.Kind == TypeKind.Unknown || targetType.GetSize() != ldobj.Type.GetSize()) {
targetType = ldobj.Type;
}
} else {
targetType = ldobj.Type;
}
if (CompoundAssignmentInstruction.IsBinaryCompatibleWithType(binary, targetType)) {
context.Step("compound assignment", inst);
// stobj(target, binary.op(ldobj(target), ...))
// => compound.op(target, ...)
inst.ReplaceWith(new CompoundAssignmentInstruction(
binary, binary.Left, binary.Right,
targetType, CompoundAssignmentType.EvaluatesToNewValue));
}
}
TransformAssignment.HandleStObjCompoundAssign(inst, context);
}
protected internal override void VisitIfInstruction(IfInstruction inst)

81
ICSharpCode.Decompiler/IL/Transforms/TransformAssignment.cs

@ -20,6 +20,7 @@ using System; @@ -20,6 +20,7 @@ using System;
using System.Diagnostics;
using System.Linq;
using ICSharpCode.Decompiler.TypeSystem;
using ICSharpCode.Decompiler.TypeSystem.Implementation;
namespace ICSharpCode.Decompiler.IL.Transforms
{
@ -124,7 +125,14 @@ namespace ICSharpCode.Decompiler.IL.Transforms @@ -124,7 +125,14 @@ namespace ICSharpCode.Decompiler.IL.Transforms
// in some cases it can be a compiler-generated local
if (mainStLoc == null || (mainStLoc.Variable.Kind != VariableKind.StackSlot && mainStLoc.Variable.Kind != VariableKind.Local))
return false;
BinaryNumericInstruction binary = mainStLoc.Value as BinaryNumericInstruction;
ILInstruction value = mainStLoc.Value;
if (value is Conv conv && conv.Kind == ConversionKind.Truncate && conv.TargetType.IsSmallIntegerType()) {
// for compound assignments to small integers, the compiler emits a "conv" instruction
value = conv.Argument;
} else {
conv = null;
}
BinaryNumericInstruction binary = value as BinaryNumericInstruction;
ILVariable localVariable = mainStLoc.Variable;
if (!localVariable.IsSingleDefinition)
return false;
@ -142,13 +150,16 @@ namespace ICSharpCode.Decompiler.IL.Transforms @@ -142,13 +150,16 @@ namespace ICSharpCode.Decompiler.IL.Transforms
return false;
if (next.Descendants.Where(d => d.MatchLdLoc(localVariable)).Count() != 1)
return false;
if (!CompoundAssignmentInstruction.IsBinaryCompatibleWithType(binary, getterCall.Method.ReturnType))
IType targetType = getterCall.Method.ReturnType;
if (!CompoundAssignmentInstruction.IsBinaryCompatibleWithType(binary, targetType))
return false;
if (conv != null && !(conv.TargetType == targetType.ToPrimitiveType() && conv.CheckForOverflow == binary.CheckForOverflow))
return false; // conv does not match binary operation
context.Step($"Inline compound assignment to '{getterCall.Method.AccessorOwner.Name}'", setterCall);
block.Instructions.RemoveAt(i + 1); // remove setter call
binary.ReplaceWith(new CompoundAssignmentInstruction(
mainStLoc.Value = new CompoundAssignmentInstruction(
binary, getterCall, binary.Right,
getterCall.Method.ReturnType, CompoundAssignmentType.EvaluatesToNewValue));
targetType, CompoundAssignmentType.EvaluatesToNewValue);
return true;
}
@ -218,13 +229,22 @@ namespace ICSharpCode.Decompiler.IL.Transforms @@ -218,13 +229,22 @@ namespace ICSharpCode.Decompiler.IL.Transforms
// ==> stloc v(compound.op.new(callvirt(callvirt get_Property(ldloc S_1)), value))
setterValue = storeInSetter.Value;
}
if (setterValue is Conv conv && conv.Kind == ConversionKind.Truncate && conv.TargetType.IsSmallIntegerType()) {
// for compound assignments to small integers, the compiler emits a "conv" instruction
setterValue = conv.Argument;
} else {
conv = null;
}
if (!(setterValue is BinaryNumericInstruction binary))
return false;
var getterCall = binary.Left as CallInstruction;
if (!MatchingGetterAndSetterCalls(getterCall, setterCall))
return false;
if (!CompoundAssignmentInstruction.IsBinaryCompatibleWithType(binary, getterCall.Method.ReturnType))
IType targetType = getterCall.Method.ReturnType;
if (!CompoundAssignmentInstruction.IsBinaryCompatibleWithType(binary, targetType))
return false;
if (conv != null && !(conv.TargetType == targetType.ToPrimitiveType() && conv.CheckForOverflow == binary.CheckForOverflow))
return false; // conv does not match binary operation
context.Step($"Compound assignment to '{getterCall.Method.AccessorOwner.Name}'", setterCall);
ILInstruction newInst = new CompoundAssignmentInstruction(
binary, getterCall, binary.Right,
@ -238,6 +258,52 @@ namespace ICSharpCode.Decompiler.IL.Transforms @@ -238,6 +258,52 @@ namespace ICSharpCode.Decompiler.IL.Transforms
return true;
}
/// <summary>
/// stobj(target, binary.op(ldobj(target), ...))
/// => compound.op(target, ...)
/// </summary>
/// <remarks>
/// Called by ExpressionTransforms.
/// </remarks>
internal static bool HandleStObjCompoundAssign(StObj inst, ILTransformContext context)
{
ILInstruction value = inst.Value;
if (value is Conv conv && conv.Kind == ConversionKind.Truncate && conv.TargetType.IsSmallIntegerType()) {
// for compound assignments to small integers, the compiler emits a "conv" instruction
value = conv.Argument;
} else {
conv = null;
}
if (!(value is BinaryNumericInstruction binary))
return false;
if (!(binary.Left is LdObj ldobj))
return false;
if (!inst.Target.Match(ldobj.Target).Success)
return false;
if (!SemanticHelper.IsPure(ldobj.Target.Flags))
return false;
// ldobj.Type may just be 'int' (due to ldind.i4) when we're actually operating on a 'ref MyEnum'.
// Try to determine the real type of the object we're modifying:
IType targetType = ldobj.Target.InferType();
if (targetType.Kind == TypeKind.Pointer || targetType.Kind == TypeKind.ByReference) {
targetType = ((TypeWithElementType)targetType).ElementType;
if (targetType.Kind == TypeKind.Unknown || targetType.GetSize() != ldobj.Type.GetSize()) {
targetType = ldobj.Type;
}
} else {
targetType = ldobj.Type;
}
if (!CompoundAssignmentInstruction.IsBinaryCompatibleWithType(binary, targetType))
return false;
if (conv != null && !(conv.TargetType == targetType.ToPrimitiveType() && conv.CheckForOverflow == binary.CheckForOverflow))
return false; // conv does not match binary operation
context.Step("compound assignment", inst);
inst.ReplaceWith(new CompoundAssignmentInstruction(
binary, binary.Left, binary.Right,
targetType, CompoundAssignmentType.EvaluatesToNewValue));
return true;
}
/// <code>
/// stloc s(value)
/// stloc l(ldloc s)
@ -280,8 +346,9 @@ namespace ICSharpCode.Decompiler.IL.Transforms @@ -280,8 +346,9 @@ namespace ICSharpCode.Decompiler.IL.Transforms
// conv instructions.
return false;
}
// With small integer types, test whether the value being stored
// is being truncated:
// With small integer types, test whether the value might be changed by
// truncation (based on type.GetSize()) followed by sign/zero extension (based on type.GetSign()).
// (it's OK to have false-positives here if we're unsure)
if (value.MatchLdcI4(out int val)) {
switch (type.GetEnumUnderlyingType().GetDefinition()?.KnownTypeCode) {
case KnownTypeCode.Boolean:

Loading…
Cancel
Save