Browse Source

Add NoUsing test case.

pull/870/merge
Siegfried Pammer 8 years ago
parent
commit
ae2e38ece4
  1. 25
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/Using.cs
  2. 77
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/Using.il
  3. 65
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/Using.opt.il
  4. 61
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/Using.opt.roslyn.il
  5. 71
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/Using.roslyn.il

25
ICSharpCode.Decompiler.Tests/TestCases/Pretty/Using.cs

@ -39,6 +39,21 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty @@ -39,6 +39,21 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
}
}
private class PrintOnDispose : IDisposable
{
private string v;
public PrintOnDispose(string v)
{
this.v = v;
}
public void Dispose()
{
Console.WriteLine(this.v);
}
}
#if LEGACY_CSC
public void SimpleUsingNullStatement()
{
@ -85,5 +100,15 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty @@ -85,5 +100,15 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
Console.WriteLine("using-body: " + usingStruct);
}
}
public void NoUsing()
{
PrintOnDispose printOnDispose = new PrintOnDispose("Wrong");
try {
printOnDispose = new PrintOnDispose("Correct");
} finally {
printOnDispose.Dispose();
}
}
}
}

77
ICSharpCode.Decompiler.Tests/TestCases/Pretty/Using.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 '3l4pawob'
.assembly ivwruwuv
{
.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 '3l4pawob.dll'
// MVID: {2C12BC13-2CF2-4EA9-AC06-49690D29B45C}
.module ivwruwuv.dll
// MVID: {CC03EEA0-A20B-4731-ADE9-CC2419DB878B}
.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: 0x02530000
// Image base: 0x00BA0000
// =============== CLASS MEMBERS DECLARATION ===================
@ -67,6 +67,42 @@ @@ -67,6 +67,42 @@
} // end of class UsingStruct
.class auto ansi nested private beforefieldinit PrintOnDispose
extends [mscorlib]System.Object
implements [mscorlib]System.IDisposable
{
.field private string v
.method public hidebysig specialname rtspecialname
instance void .ctor(string v) cil managed
{
// Code size 17 (0x11)
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance void [mscorlib]System.Object::.ctor()
IL_0006: nop
IL_0007: nop
IL_0008: ldarg.0
IL_0009: ldarg.1
IL_000a: stfld string ICSharpCode.Decompiler.Tests.TestCases.Pretty.Using/PrintOnDispose::v
IL_000f: nop
IL_0010: ret
} // end of method PrintOnDispose::.ctor
.method public hidebysig newslot virtual final
instance void Dispose() cil managed
{
// Code size 14 (0xe)
.maxstack 8
IL_0000: nop
IL_0001: ldarg.0
IL_0002: ldfld string ICSharpCode.Decompiler.Tests.TestCases.Pretty.Using/PrintOnDispose::v
IL_0007: call void [mscorlib]System.Console::WriteLine(string)
IL_000c: nop
IL_000d: ret
} // end of method PrintOnDispose::Dispose
} // end of class PrintOnDispose
.method public hidebysig instance void
SimpleUsingNullStatement() cil managed
{
@ -302,6 +338,39 @@ @@ -302,6 +338,39 @@
IL_0034: ret
} // end of method Using::UsingStatementOnStructWithVariable
.method public hidebysig instance void
NoUsing() cil managed
{
// Code size 39 (0x27)
.maxstack 1
.locals init (class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Using/PrintOnDispose V_0)
IL_0000: nop
IL_0001: ldstr "Wrong"
IL_0006: newobj instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.Using/PrintOnDispose::.ctor(string)
IL_000b: stloc.0
.try
{
IL_000c: nop
IL_000d: ldstr "Correct"
IL_0012: newobj instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.Using/PrintOnDispose::.ctor(string)
IL_0017: stloc.0
IL_0018: nop
IL_0019: leave.s IL_0025
} // end .try
finally
{
IL_001b: nop
IL_001c: ldloc.0
IL_001d: callvirt instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.Using/PrintOnDispose::Dispose()
IL_0022: nop
IL_0023: nop
IL_0024: endfinally
} // end handler
IL_0025: nop
IL_0026: ret
} // end of method Using::NoUsing
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{

65
ICSharpCode.Decompiler.Tests/TestCases/Pretty/Using.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 uo2xsddx
.assembly '2darmbjq'
{
.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 uo2xsddx.dll
// MVID: {27F758E4-41DD-43CE-A9B2-39385F597AAF}
.module '2darmbjq.dll'
// MVID: {947C8C54-1B8B-4766-9D81-4FCCD54C005F}
.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: 0x02B80000
// =============== CLASS MEMBERS DECLARATION ===================
@ -64,6 +64,37 @@ @@ -64,6 +64,37 @@
} // end of class UsingStruct
.class auto ansi nested private beforefieldinit PrintOnDispose
extends [mscorlib]System.Object
implements [mscorlib]System.IDisposable
{
.field private string v
.method public hidebysig specialname rtspecialname
instance void .ctor(string v) cil managed
{
// Code size 14 (0xe)
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance void [mscorlib]System.Object::.ctor()
IL_0006: ldarg.0
IL_0007: ldarg.1
IL_0008: stfld string ICSharpCode.Decompiler.Tests.TestCases.Pretty.Using/PrintOnDispose::v
IL_000d: ret
} // end of method PrintOnDispose::.ctor
.method public hidebysig newslot virtual final
instance void Dispose() cil managed
{
// Code size 12 (0xc)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldfld string ICSharpCode.Decompiler.Tests.TestCases.Pretty.Using/PrintOnDispose::v
IL_0006: call void [mscorlib]System.Console::WriteLine(string)
IL_000b: ret
} // end of method PrintOnDispose::Dispose
} // end of class PrintOnDispose
.method public hidebysig instance void
SimpleUsingNullStatement() cil managed
{
@ -241,6 +272,32 @@ @@ -241,6 +272,32 @@
IL_002d: ret
} // end of method Using::UsingStatementOnStructWithVariable
.method public hidebysig instance void
NoUsing() cil managed
{
// Code size 32 (0x20)
.maxstack 1
.locals init (class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Using/PrintOnDispose V_0)
IL_0000: ldstr "Wrong"
IL_0005: newobj instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.Using/PrintOnDispose::.ctor(string)
IL_000a: stloc.0
.try
{
IL_000b: ldstr "Correct"
IL_0010: newobj instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.Using/PrintOnDispose::.ctor(string)
IL_0015: stloc.0
IL_0016: leave.s IL_001f
} // end .try
finally
{
IL_0018: ldloc.0
IL_0019: callvirt instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.Using/PrintOnDispose::Dispose()
IL_001e: endfinally
} // end handler
IL_001f: ret
} // end of method Using::NoUsing
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{

61
ICSharpCode.Decompiler.Tests/TestCases/Pretty/Using.opt.roslyn.il

@ -25,14 +25,14 @@ @@ -25,14 +25,14 @@
.ver 0:0:0:0
}
.module Using.dll
// MVID: {6F6E9DB6-A82C-4001-BDFB-56864E8E1A98}
// MVID: {8BD4B2FD-6883-4252-8E37-486B759E3F3E}
.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: 0x02870000
// Image base: 0x00CA0000
// =============== CLASS MEMBERS DECLARATION ===================
@ -68,6 +68,37 @@ @@ -68,6 +68,37 @@
} // end of class UsingStruct
.class auto ansi nested private beforefieldinit PrintOnDispose
extends [mscorlib]System.Object
implements [mscorlib]System.IDisposable
{
.field private string v
.method public hidebysig specialname rtspecialname
instance void .ctor(string v) cil managed
{
// Code size 14 (0xe)
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance void [mscorlib]System.Object::.ctor()
IL_0006: ldarg.0
IL_0007: ldarg.1
IL_0008: stfld string ICSharpCode.Decompiler.Tests.TestCases.Pretty.Using/PrintOnDispose::v
IL_000d: ret
} // end of method PrintOnDispose::.ctor
.method public hidebysig newslot virtual final
instance void Dispose() cil managed
{
// Code size 12 (0xc)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldfld string ICSharpCode.Decompiler.Tests.TestCases.Pretty.Using/PrintOnDispose::v
IL_0006: call void [mscorlib]System.Console::WriteLine(string)
IL_000b: ret
} // end of method PrintOnDispose::Dispose
} // end of class PrintOnDispose
.method public hidebysig instance void
SimpleUsingExpressionStatement() cil managed
{
@ -218,6 +249,32 @@ @@ -218,6 +249,32 @@
IL_002d: ret
} // end of method Using::UsingStatementOnStructWithVariable
.method public hidebysig instance void
NoUsing() cil managed
{
// Code size 32 (0x20)
.maxstack 1
.locals init (class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Using/PrintOnDispose V_0)
IL_0000: ldstr "Wrong"
IL_0005: newobj instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.Using/PrintOnDispose::.ctor(string)
IL_000a: stloc.0
.try
{
IL_000b: ldstr "Correct"
IL_0010: newobj instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.Using/PrintOnDispose::.ctor(string)
IL_0015: stloc.0
IL_0016: leave.s IL_001f
} // end .try
finally
{
IL_0018: ldloc.0
IL_0019: callvirt instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.Using/PrintOnDispose::Dispose()
IL_001e: endfinally
} // end handler
IL_001f: ret
} // end of method Using::NoUsing
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{

71
ICSharpCode.Decompiler.Tests/TestCases/Pretty/Using.roslyn.il

@ -25,14 +25,14 @@ @@ -25,14 +25,14 @@
.ver 0:0:0:0
}
.module Using.dll
// MVID: {1EB77740-4391-47E8-B1E6-5F7B79BDFBA6}
// MVID: {3686D0B4-0A65-4B60-A432-7042528E2212}
.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: 0x009A0000
// Image base: 0x02E50000
// =============== CLASS MEMBERS DECLARATION ===================
@ -71,6 +71,41 @@ @@ -71,6 +71,41 @@
} // end of class UsingStruct
.class auto ansi nested private beforefieldinit PrintOnDispose
extends [mscorlib]System.Object
implements [mscorlib]System.IDisposable
{
.field private string v
.method public hidebysig specialname rtspecialname
instance void .ctor(string v) cil managed
{
// Code size 16 (0x10)
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance void [mscorlib]System.Object::.ctor()
IL_0006: nop
IL_0007: nop
IL_0008: ldarg.0
IL_0009: ldarg.1
IL_000a: stfld string ICSharpCode.Decompiler.Tests.TestCases.Pretty.Using/PrintOnDispose::v
IL_000f: ret
} // end of method PrintOnDispose::.ctor
.method public hidebysig newslot virtual final
instance void Dispose() cil managed
{
// Code size 14 (0xe)
.maxstack 8
IL_0000: nop
IL_0001: ldarg.0
IL_0002: ldfld string ICSharpCode.Decompiler.Tests.TestCases.Pretty.Using/PrintOnDispose::v
IL_0007: call void [mscorlib]System.Console::WriteLine(string)
IL_000c: nop
IL_000d: ret
} // end of method PrintOnDispose::Dispose
} // end of class PrintOnDispose
.method public hidebysig instance void
SimpleUsingExpressionStatement() cil managed
{
@ -247,6 +282,38 @@ @@ -247,6 +282,38 @@
IL_0032: ret
} // end of method Using::UsingStatementOnStructWithVariable
.method public hidebysig instance void
NoUsing() cil managed
{
// Code size 38 (0x26)
.maxstack 1
.locals init (class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Using/PrintOnDispose V_0)
IL_0000: nop
IL_0001: ldstr "Wrong"
IL_0006: newobj instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.Using/PrintOnDispose::.ctor(string)
IL_000b: stloc.0
.try
{
IL_000c: nop
IL_000d: ldstr "Correct"
IL_0012: newobj instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.Using/PrintOnDispose::.ctor(string)
IL_0017: stloc.0
IL_0018: nop
IL_0019: leave.s IL_0025
} // end .try
finally
{
IL_001b: nop
IL_001c: ldloc.0
IL_001d: callvirt instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.Using/PrintOnDispose::Dispose()
IL_0022: nop
IL_0023: nop
IL_0024: endfinally
} // end handler
IL_0025: ret
} // end of method Using::NoUsing
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{

Loading…
Cancel
Save