diff --git a/ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj b/ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj index a76a5ac6a..6b9061c08 100644 --- a/ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj +++ b/ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj @@ -63,6 +63,7 @@ + diff --git a/ICSharpCode.Decompiler.Tests/PrettyTestRunner.cs b/ICSharpCode.Decompiler.Tests/PrettyTestRunner.cs index 0c73158cc..ef5480f17 100644 --- a/ICSharpCode.Decompiler.Tests/PrettyTestRunner.cs +++ b/ICSharpCode.Decompiler.Tests/PrettyTestRunner.cs @@ -131,6 +131,12 @@ namespace ICSharpCode.Decompiler.Tests } } + [Test] + public void Generics([ValueSource("defaultOptions")] CompilerOptions cscOptions) + { + Run(cscOptions: cscOptions); + } + [Test] public void Loops([ValueSource("defaultOptions")] CompilerOptions cscOptions) { diff --git a/ICSharpCode.Decompiler.Tests/TestCases/Correctness/Generics.cs b/ICSharpCode.Decompiler.Tests/TestCases/Correctness/Generics.cs index 1b9433ee2..0ff0b26a5 100644 --- a/ICSharpCode.Decompiler.Tests/TestCases/Correctness/Generics.cs +++ b/ICSharpCode.Decompiler.Tests/TestCases/Correctness/Generics.cs @@ -47,16 +47,6 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness { Console.WriteLine(typeof(T1) + " " + typeof(T2)); } - - public T CastToTypeParameter(DerivedClass d) where T: BaseClass - { - return (T)(BaseClass)d; - } - - public T New() where T : new() - { - return new T(); - } } class GenericClass diff --git a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/Generics.cs b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/Generics.cs new file mode 100644 index 000000000..419e549b5 --- /dev/null +++ b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/Generics.cs @@ -0,0 +1,38 @@ +using System; + +namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty +{ + internal class Generics + { + private class GenericClass + { + public void M(out GenericClass self) + { + self = this; + } + } + + public class BaseClass + { + } + + public class DerivedClass : BaseClass + { + } + + public T CastToTypeParameter(DerivedClass d) where T : BaseClass + { + return (T)(BaseClass)d; + } + + public T New() where T : new() + { + return new T(); + } + + public bool IsNull(T t) + { + return t == null; + } + } +} diff --git a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/Generics.il b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/Generics.il new file mode 100644 index 000000000..8b95ef8de --- /dev/null +++ b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/Generics.il @@ -0,0 +1,171 @@ + +// Microsoft (R) .NET Framework IL Disassembler. Version 4.0.30319.17929 +// Copyright (c) Microsoft Corporation. All rights reserved. + + + +// Metadata version: v4.0.30319 +.assembly extern mscorlib +{ + .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4.. + .ver 4:0:0:0 +} +.assembly org2btap +{ + .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 + 63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows. + .permissionset reqmin + = {[mscorlib]System.Security.Permissions.SecurityPermissionAttribute = {property bool 'SkipVerification' = bool(true)}} + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.module org2btap.dll +// MVID: {C17EE898-3151-4FD3-9C62-06322F89471A} +.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: 0x02570000 + + +// =============== CLASS MEMBERS DECLARATION =================== + +.class private auto ansi beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics + extends [mscorlib]System.Object +{ + .class auto ansi nested private beforefieldinit GenericClass`1 + extends [mscorlib]System.Object + { + .method public hidebysig instance void + M([out] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/GenericClass`1& self) cil managed + { + // Code size 5 (0x5) + .maxstack 8 + IL_0000: nop + IL_0001: ldarg.1 + IL_0002: ldarg.0 + IL_0003: stind.ref + IL_0004: ret + } // end of method GenericClass`1::M + + .method public hidebysig specialname rtspecialname + instance void .ctor() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Object::.ctor() + IL_0006: ret + } // end of method GenericClass`1::.ctor + + } // end of class GenericClass`1 + + .class auto ansi nested public beforefieldinit BaseClass + extends [mscorlib]System.Object + { + .method public hidebysig specialname rtspecialname + instance void .ctor() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Object::.ctor() + IL_0006: ret + } // end of method BaseClass::.ctor + + } // end of class BaseClass + + .class auto ansi nested public beforefieldinit DerivedClass + extends ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/BaseClass + { + .method public hidebysig specialname rtspecialname + instance void .ctor() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/BaseClass::.ctor() + IL_0006: ret + } // end of method DerivedClass::.ctor + + } // end of class DerivedClass + + .method public hidebysig instance !!T CastToTypeParameter<(ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/BaseClass) T>(class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/DerivedClass d) cil managed + { + // Code size 12 (0xc) + .maxstack 1 + .locals init (!!T V_0) + IL_0000: nop + IL_0001: ldarg.1 + IL_0002: unbox.any !!T + IL_0007: stloc.0 + IL_0008: br.s IL_000a + + IL_000a: ldloc.0 + IL_000b: ret + } // end of method Generics::CastToTypeParameter + + .method public hidebysig instance !!T New<.ctor T>() cil managed + { + // Code size 39 (0x27) + .maxstack 1 + .locals init (!!T V_0, + !!T V_1) + IL_0000: nop + IL_0001: ldloca.s V_1 + IL_0003: initobj !!T + IL_0009: ldloc.1 + IL_000a: box !!T + IL_000f: brfalse.s IL_001c + + IL_0011: ldloca.s V_1 + IL_0013: initobj !!T + IL_0019: ldloc.1 + IL_001a: br.s IL_0021 + + IL_001c: call !!0 [mscorlib]System.Activator::CreateInstance() + IL_0021: nop + IL_0022: stloc.0 + IL_0023: br.s IL_0025 + + IL_0025: ldloc.0 + IL_0026: ret + } // end of method Generics::New + + .method public hidebysig static bool IsNull(!!T t) cil managed + { + // Code size 15 (0xf) + .maxstack 2 + .locals init (bool V_0) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: box !!T + IL_0007: ldnull + IL_0008: ceq + IL_000a: stloc.0 + IL_000b: br.s IL_000d + + IL_000d: ldloc.0 + IL_000e: ret + } // end of method Generics::IsNull + + .method public hidebysig specialname rtspecialname + instance void .ctor() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Object::.ctor() + IL_0006: ret + } // end of method Generics::.ctor + +} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics + + +// ============================================================= + +// *********** DISASSEMBLY COMPLETE *********************** +// WARNING: Created Win32 resource file ../../../TestCases/Pretty\Generics.res diff --git a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/Generics.opt.il b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/Generics.opt.il new file mode 100644 index 000000000..9f393ac11 --- /dev/null +++ b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/Generics.opt.il @@ -0,0 +1,152 @@ + +// Microsoft (R) .NET Framework IL Disassembler. Version 4.0.30319.17929 +// Copyright (c) Microsoft Corporation. All rights reserved. + + + +// Metadata version: v4.0.30319 +.assembly extern mscorlib +{ + .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4.. + .ver 4:0:0:0 +} +.assembly '4ebood3j' +{ + .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 + 63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows. + .permissionset reqmin + = {[mscorlib]System.Security.Permissions.SecurityPermissionAttribute = {property bool 'SkipVerification' = bool(true)}} + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.module '4ebood3j.dll' +// MVID: {EFF51081-05A0-430F-B639-218464AEAF1E} +.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: 0x00C40000 + + +// =============== CLASS MEMBERS DECLARATION =================== + +.class private auto ansi beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics + extends [mscorlib]System.Object +{ + .class auto ansi nested private beforefieldinit GenericClass`1 + extends [mscorlib]System.Object + { + .method public hidebysig instance void + M([out] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/GenericClass`1& self) cil managed + { + // Code size 4 (0x4) + .maxstack 8 + IL_0000: ldarg.1 + IL_0001: ldarg.0 + IL_0002: stind.ref + IL_0003: ret + } // end of method GenericClass`1::M + + .method public hidebysig specialname rtspecialname + instance void .ctor() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Object::.ctor() + IL_0006: ret + } // end of method GenericClass`1::.ctor + + } // end of class GenericClass`1 + + .class auto ansi nested public beforefieldinit BaseClass + extends [mscorlib]System.Object + { + .method public hidebysig specialname rtspecialname + instance void .ctor() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Object::.ctor() + IL_0006: ret + } // end of method BaseClass::.ctor + + } // end of class BaseClass + + .class auto ansi nested public beforefieldinit DerivedClass + extends ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/BaseClass + { + .method public hidebysig specialname rtspecialname + instance void .ctor() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/BaseClass::.ctor() + IL_0006: ret + } // end of method DerivedClass::.ctor + + } // end of class DerivedClass + + .method public hidebysig instance !!T CastToTypeParameter<(ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/BaseClass) T>(class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/DerivedClass d) cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.1 + IL_0001: unbox.any !!T + IL_0006: ret + } // end of method Generics::CastToTypeParameter + + .method public hidebysig instance !!T New<.ctor T>() cil managed + { + // Code size 32 (0x20) + .maxstack 1 + .locals init (!!T V_0, + !!T V_1) + IL_0000: ldloca.s V_0 + IL_0002: initobj !!T + IL_0008: ldloc.0 + IL_0009: box !!T + IL_000e: brfalse.s IL_001a + + IL_0010: ldloca.s V_1 + IL_0012: initobj !!T + IL_0018: ldloc.1 + IL_0019: ret + + IL_001a: call !!0 [mscorlib]System.Activator::CreateInstance() + IL_001f: ret + } // end of method Generics::New + + .method public hidebysig static bool IsNull(!!T t) cil managed + { + // Code size 10 (0xa) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: box !!T + IL_0006: ldnull + IL_0007: ceq + IL_0009: ret + } // end of method Generics::IsNull + + .method public hidebysig specialname rtspecialname + instance void .ctor() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Object::.ctor() + IL_0006: ret + } // end of method Generics::.ctor + +} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics + + +// ============================================================= + +// *********** DISASSEMBLY COMPLETE *********************** +// WARNING: Created Win32 resource file ../../../TestCases/Pretty\Generics.opt.res diff --git a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/Generics.opt.roslyn.il b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/Generics.opt.roslyn.il new file mode 100644 index 000000000..d343424dc --- /dev/null +++ b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/Generics.opt.roslyn.il @@ -0,0 +1,142 @@ + +// Microsoft (R) .NET Framework IL Disassembler. Version 4.0.30319.17929 +// Copyright (c) Microsoft Corporation. All rights reserved. + + + +// Metadata version: v4.0.30319 +.assembly extern mscorlib +{ + .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4.. + .ver 4:0:0:0 +} +.assembly Generics +{ + .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 + 63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows. + + // --- The following custom attribute is added automatically, do not uncomment ------- + // .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggableAttribute/DebuggingModes) = ( 01 00 02 00 00 00 00 00 ) + + .permissionset reqmin + = {[mscorlib]System.Security.Permissions.SecurityPermissionAttribute = {property bool 'SkipVerification' = bool(true)}} + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.module Generics.dll +// MVID: {A68CE966-2788-410B-9ADC-67827754D69A} +.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: 0x007F0000 + + +// =============== CLASS MEMBERS DECLARATION =================== + +.class private auto ansi beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics + extends [mscorlib]System.Object +{ + .class auto ansi nested private beforefieldinit GenericClass`1 + extends [mscorlib]System.Object + { + .method public hidebysig instance void + M([out] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/GenericClass`1& self) cil managed + { + // Code size 4 (0x4) + .maxstack 8 + IL_0000: ldarg.1 + IL_0001: ldarg.0 + IL_0002: stind.ref + IL_0003: ret + } // end of method GenericClass`1::M + + .method public hidebysig specialname rtspecialname + instance void .ctor() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Object::.ctor() + IL_0006: ret + } // end of method GenericClass`1::.ctor + + } // end of class GenericClass`1 + + .class auto ansi nested public beforefieldinit BaseClass + extends [mscorlib]System.Object + { + .method public hidebysig specialname rtspecialname + instance void .ctor() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Object::.ctor() + IL_0006: ret + } // end of method BaseClass::.ctor + + } // end of class BaseClass + + .class auto ansi nested public beforefieldinit DerivedClass + extends ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/BaseClass + { + .method public hidebysig specialname rtspecialname + instance void .ctor() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/BaseClass::.ctor() + IL_0006: ret + } // end of method DerivedClass::.ctor + + } // end of class DerivedClass + + .method public hidebysig instance !!T CastToTypeParameter<(ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/BaseClass) T>(class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/DerivedClass d) cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.1 + IL_0001: unbox.any !!T + IL_0006: ret + } // end of method Generics::CastToTypeParameter + + .method public hidebysig instance !!T New<.ctor T>() cil managed + { + // Code size 6 (0x6) + .maxstack 8 + IL_0000: call !!0 [mscorlib]System.Activator::CreateInstance() + IL_0005: ret + } // end of method Generics::New + + .method public hidebysig static bool IsNull(!!T t) cil managed + { + // Code size 10 (0xa) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: box !!T + IL_0006: ldnull + IL_0007: ceq + IL_0009: ret + } // end of method Generics::IsNull + + .method public hidebysig specialname rtspecialname + instance void .ctor() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Object::.ctor() + IL_0006: ret + } // end of method Generics::.ctor + +} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics + + +// ============================================================= + +// *********** DISASSEMBLY COMPLETE *********************** diff --git a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/Generics.roslyn.il b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/Generics.roslyn.il new file mode 100644 index 000000000..0db4d7c7a --- /dev/null +++ b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/Generics.roslyn.il @@ -0,0 +1,165 @@ + +// Microsoft (R) .NET Framework IL Disassembler. Version 4.0.30319.17929 +// Copyright (c) Microsoft Corporation. All rights reserved. + + + +// Metadata version: v4.0.30319 +.assembly extern mscorlib +{ + .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4.. + .ver 4:0:0:0 +} +.assembly Generics +{ + .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 + 63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows. + + // --- The following custom attribute is added automatically, do not uncomment ------- + // .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggableAttribute/DebuggingModes) = ( 01 00 07 01 00 00 00 00 ) + + .permissionset reqmin + = {[mscorlib]System.Security.Permissions.SecurityPermissionAttribute = {property bool 'SkipVerification' = bool(true)}} + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.module Generics.dll +// MVID: {ADEAC82A-8D93-4D9A-B37E-3FC39CBDC54B} +.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: 0x007E0000 + + +// =============== CLASS MEMBERS DECLARATION =================== + +.class private auto ansi beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics + extends [mscorlib]System.Object +{ + .class auto ansi nested private beforefieldinit GenericClass`1 + extends [mscorlib]System.Object + { + .method public hidebysig instance void + M([out] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/GenericClass`1& self) cil managed + { + // Code size 5 (0x5) + .maxstack 8 + IL_0000: nop + IL_0001: ldarg.1 + IL_0002: ldarg.0 + IL_0003: stind.ref + IL_0004: ret + } // end of method GenericClass`1::M + + .method public hidebysig specialname rtspecialname + instance void .ctor() cil managed + { + // Code size 8 (0x8) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Object::.ctor() + IL_0006: nop + IL_0007: ret + } // end of method GenericClass`1::.ctor + + } // end of class GenericClass`1 + + .class auto ansi nested public beforefieldinit BaseClass + extends [mscorlib]System.Object + { + .method public hidebysig specialname rtspecialname + instance void .ctor() cil managed + { + // Code size 8 (0x8) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Object::.ctor() + IL_0006: nop + IL_0007: ret + } // end of method BaseClass::.ctor + + } // end of class BaseClass + + .class auto ansi nested public beforefieldinit DerivedClass + extends ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/BaseClass + { + .method public hidebysig specialname rtspecialname + instance void .ctor() cil managed + { + // Code size 8 (0x8) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/BaseClass::.ctor() + IL_0006: nop + IL_0007: ret + } // end of method DerivedClass::.ctor + + } // end of class DerivedClass + + .method public hidebysig instance !!T CastToTypeParameter<(ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/BaseClass) T>(class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/DerivedClass d) cil managed + { + // Code size 12 (0xc) + .maxstack 1 + .locals init (!!T V_0) + IL_0000: nop + IL_0001: ldarg.1 + IL_0002: unbox.any !!T + IL_0007: stloc.0 + IL_0008: br.s IL_000a + + IL_000a: ldloc.0 + IL_000b: ret + } // end of method Generics::CastToTypeParameter + + .method public hidebysig instance !!T New<.ctor T>() cil managed + { + // Code size 11 (0xb) + .maxstack 1 + .locals init (!!T V_0) + IL_0000: nop + IL_0001: call !!0 [mscorlib]System.Activator::CreateInstance() + IL_0006: stloc.0 + IL_0007: br.s IL_0009 + + IL_0009: ldloc.0 + IL_000a: ret + } // end of method Generics::New + + .method public hidebysig static bool IsNull(!!T t) cil managed + { + // Code size 15 (0xf) + .maxstack 2 + .locals init (bool V_0) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: box !!T + IL_0007: ldnull + IL_0008: ceq + IL_000a: stloc.0 + IL_000b: br.s IL_000d + + IL_000d: ldloc.0 + IL_000e: ret + } // end of method Generics::IsNull + + .method public hidebysig specialname rtspecialname + instance void .ctor() cil managed + { + // Code size 8 (0x8) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Object::.ctor() + IL_0006: nop + IL_0007: ret + } // end of method Generics::.ctor + +} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics + + +// ============================================================= + +// *********** DISASSEMBLY COMPLETE ***********************