Browse Source

Add some more tests for compound assignment on struct members.

Closes #864.
pull/960/head
Daniel Grunwald 8 years ago
parent
commit
174a0d9eca
  1. 2
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/CompoundAssignmentTest.cs
  2. 43
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/CompoundAssignmentTest.il
  3. 43
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/CompoundAssignmentTest.opt.il
  4. 38
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/CompoundAssignmentTest.opt.roslyn.il
  5. 41
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/CompoundAssignmentTest.roslyn.il

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

@ -224,6 +224,8 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty @@ -224,6 +224,8 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
public void NestedField()
{
if (this.field1.HasIndex) {
Console.WriteLine(this.field1.Field *= 2);
this.field1.Field++;
Console.WriteLine(this.field1.Field++);
}
}

43
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 ky5fl4b0
.assembly c4ghupf5
{
.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 ky5fl4b0.dll
// MVID: {C370770B-D135-491B-8AAA-78D09B51E79A}
.module c4ghupf5.dll
// MVID: {A420A635-A261-460E-9F30-F603256DEDB0}
.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: 0x018D0000
// Image base: 0x02FD0000
// =============== CLASS MEMBERS DECLARATION ===================
@ -740,7 +740,7 @@ @@ -740,7 +740,7 @@
.method public hidebysig instance void
NestedField() cil managed
{
// Code size 50 (0x32)
// Code size 97 (0x61)
.maxstack 3
.locals init (bool V_0,
int32 V_1)
@ -752,23 +752,42 @@ @@ -752,23 +752,42 @@
IL_000d: ceq
IL_000f: stloc.0
IL_0010: ldloc.0
IL_0011: brtrue.s IL_0031
IL_0011: brtrue.s IL_0060
IL_0013: nop
IL_0014: ldarg.0
IL_0015: ldflda valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/StructContainer ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::field1
IL_001a: dup
IL_001b: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/StructContainer::Field
IL_0020: dup
IL_0021: stloc.1
IL_0022: ldc.i4.1
IL_0023: add
IL_0020: ldc.i4.2
IL_0021: mul
IL_0022: dup
IL_0023: stloc.1
IL_0024: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/StructContainer::Field
IL_0029: ldloc.1
IL_002a: call void [mscorlib]System.Console::WriteLine(int32)
IL_002f: nop
IL_0030: nop
IL_0031: ret
IL_0030: ldarg.0
IL_0031: ldflda valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/StructContainer ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::field1
IL_0036: dup
IL_0037: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/StructContainer::Field
IL_003c: ldc.i4.1
IL_003d: add
IL_003e: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/StructContainer::Field
IL_0043: ldarg.0
IL_0044: ldflda valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/StructContainer ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::field1
IL_0049: dup
IL_004a: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/StructContainer::Field
IL_004f: dup
IL_0050: stloc.1
IL_0051: ldc.i4.1
IL_0052: add
IL_0053: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/StructContainer::Field
IL_0058: ldloc.1
IL_0059: call void [mscorlib]System.Console::WriteLine(int32)
IL_005e: nop
IL_005f: nop
IL_0060: ret
} // end of method CompoundAssignmentTest::NestedField
.method public hidebysig instance void

43
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 fwwjsv0p
.assembly '0ffxad1m'
{
.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 fwwjsv0p.dll
// MVID: {115B8AEA-ECDD-40D2-AD1D-BE7A4D5D451E}
.module '0ffxad1m.dll'
// MVID: {C53B3CFA-3FF4-4724-8DBE-8B180FA612BA}
.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: 0x00950000
// Image base: 0x028A0000
// =============== CLASS MEMBERS DECLARATION ===================
@ -637,26 +637,45 @@ @@ -637,26 +637,45 @@
.method public hidebysig instance void
NestedField() cil managed
{
// Code size 41 (0x29)
// Code size 87 (0x57)
.maxstack 3
.locals init (int32 V_0)
.locals init (int32 V_0,
int32 V_1)
IL_0000: ldarg.0
IL_0001: ldflda valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/StructContainer ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::field1
IL_0006: ldfld bool ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/StructContainer::HasIndex
IL_000b: brfalse.s IL_0028
IL_000b: brfalse.s IL_0056
IL_000d: ldarg.0
IL_000e: ldflda valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/StructContainer ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::field1
IL_0013: dup
IL_0014: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/StructContainer::Field
IL_0019: dup
IL_001a: stloc.0
IL_001b: ldc.i4.1
IL_001c: add
IL_0019: ldc.i4.2
IL_001a: mul
IL_001b: dup
IL_001c: stloc.0
IL_001d: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/StructContainer::Field
IL_0022: ldloc.0
IL_0023: call void [mscorlib]System.Console::WriteLine(int32)
IL_0028: ret
IL_0028: ldarg.0
IL_0029: ldflda valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/StructContainer ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::field1
IL_002e: dup
IL_002f: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/StructContainer::Field
IL_0034: ldc.i4.1
IL_0035: add
IL_0036: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/StructContainer::Field
IL_003b: ldarg.0
IL_003c: ldflda valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/StructContainer ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::field1
IL_0041: dup
IL_0042: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/StructContainer::Field
IL_0047: dup
IL_0048: stloc.1
IL_0049: ldc.i4.1
IL_004a: add
IL_004b: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/StructContainer::Field
IL_0050: ldloc.1
IL_0051: call void [mscorlib]System.Console::WriteLine(int32)
IL_0056: ret
} // end of method CompoundAssignmentTest::NestedField
.method public hidebysig instance void

38
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: {6E167114-971D-41D3-B5C0-4D9D477E18F9}
// MVID: {EE880025-0C8C-414F-BD89-E5DB86D9B5FA}
.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: 0x00C70000
// Image base: 0x016C0000
// =============== CLASS MEMBERS DECLARATION ===================
@ -639,27 +639,47 @@ @@ -639,27 +639,47 @@
.method public hidebysig instance void
NestedField() cil managed
{
// Code size 38 (0x26)
// Code size 78 (0x4e)
.maxstack 3
.locals init (int32 V_0)
IL_0000: ldarg.0
IL_0001: ldflda valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/StructContainer ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::field1
IL_0006: ldfld bool ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/StructContainer::HasIndex
IL_000b: brfalse.s IL_0025
IL_000b: brfalse.s IL_004d
IL_000d: ldarg.0
IL_000e: ldflda valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/StructContainer ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::field1
IL_0013: ldflda int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/StructContainer::Field
IL_0018: dup
IL_0019: ldind.i4
IL_001a: stloc.0
IL_001b: ldloc.0
IL_001c: ldc.i4.1
IL_001d: add
IL_001a: ldc.i4.2
IL_001b: mul
IL_001c: dup
IL_001d: stloc.0
IL_001e: stind.i4
IL_001f: ldloc.0
IL_0020: call void [mscorlib]System.Console::WriteLine(int32)
IL_0025: ret
IL_0025: ldarg.0
IL_0026: ldflda valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/StructContainer ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::field1
IL_002b: ldflda int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/StructContainer::Field
IL_0030: dup
IL_0031: ldind.i4
IL_0032: ldc.i4.1
IL_0033: add
IL_0034: stind.i4
IL_0035: ldarg.0
IL_0036: ldflda valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/StructContainer ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::field1
IL_003b: ldflda int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/StructContainer::Field
IL_0040: dup
IL_0041: ldind.i4
IL_0042: stloc.0
IL_0043: ldloc.0
IL_0044: ldc.i4.1
IL_0045: add
IL_0046: stind.i4
IL_0047: ldloc.0
IL_0048: call void [mscorlib]System.Console::WriteLine(int32)
IL_004d: ret
} // end of method CompoundAssignmentTest::NestedField
.method public hidebysig instance void

41
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: {A617B3F7-CCDD-4058-9EEB-9D57B526A02A}
// MVID: {367B213F-CE98-4EEA-B458-88A41927D3BC}
.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: 0x02410000
// Image base: 0x006A0000
// =============== CLASS MEMBERS DECLARATION ===================
@ -730,7 +730,7 @@ @@ -730,7 +730,7 @@
.method public hidebysig instance void
NestedField() cil managed
{
// Code size 44 (0x2c)
// Code size 85 (0x55)
.maxstack 3
.locals init (bool V_0,
int32 V_1)
@ -740,7 +740,7 @@ @@ -740,7 +740,7 @@
IL_0007: ldfld bool ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/StructContainer::HasIndex
IL_000c: stloc.0
IL_000d: ldloc.0
IL_000e: brfalse.s IL_002b
IL_000e: brfalse.s IL_0054
IL_0010: nop
IL_0011: ldarg.0
@ -748,16 +748,37 @@ @@ -748,16 +748,37 @@
IL_0017: ldflda int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/StructContainer::Field
IL_001c: dup
IL_001d: ldind.i4
IL_001e: stloc.1
IL_001f: ldloc.1
IL_0020: ldc.i4.1
IL_0021: add
IL_001e: ldc.i4.2
IL_001f: mul
IL_0020: dup
IL_0021: stloc.1
IL_0022: stind.i4
IL_0023: ldloc.1
IL_0024: call void [mscorlib]System.Console::WriteLine(int32)
IL_0029: nop
IL_002a: nop
IL_002b: ret
IL_002a: ldarg.0
IL_002b: ldflda valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/StructContainer ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::field1
IL_0030: ldflda int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/StructContainer::Field
IL_0035: dup
IL_0036: ldind.i4
IL_0037: ldc.i4.1
IL_0038: add
IL_0039: stind.i4
IL_003a: ldarg.0
IL_003b: ldflda valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/StructContainer ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::field1
IL_0040: ldflda int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/StructContainer::Field
IL_0045: dup
IL_0046: ldind.i4
IL_0047: stloc.1
IL_0048: ldloc.1
IL_0049: ldc.i4.1
IL_004a: add
IL_004b: stind.i4
IL_004c: ldloc.1
IL_004d: call void [mscorlib]System.Console::WriteLine(int32)
IL_0052: nop
IL_0053: nop
IL_0054: ret
} // end of method CompoundAssignmentTest::NestedField
.method public hidebysig instance void

Loading…
Cancel
Save