diff --git a/ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj b/ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj index 9e0f63b49..ba1309172 100644 --- a/ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj +++ b/ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj @@ -68,6 +68,7 @@ + diff --git a/ICSharpCode.Decompiler.Tests/PrettyTestRunner.cs b/ICSharpCode.Decompiler.Tests/PrettyTestRunner.cs index f80cc3498..ac71f7e9c 100644 --- a/ICSharpCode.Decompiler.Tests/PrettyTestRunner.cs +++ b/ICSharpCode.Decompiler.Tests/PrettyTestRunner.cs @@ -285,6 +285,12 @@ namespace ICSharpCode.Decompiler.Tests RunForLibrary(cscOptions: cscOptions); } + [Test] + public void NamedArguments([ValueSource("defaultOptions")] CSharpCompilerOptions cscOptions) + { + RunForLibrary(cscOptions: cscOptions); + } + [Test] public void Issue1080([ValueSource(nameof(roslynOnlyOptions))] CSharpCompilerOptions cscOptions) { diff --git a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/NamedArguments.cs b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/NamedArguments.cs new file mode 100644 index 000000000..f6bc4d7eb --- /dev/null +++ b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/NamedArguments.cs @@ -0,0 +1,45 @@ +// Copyright (c) 2018 Daniel Grunwald +// +// Permission is hereby granted, free of charge, to any person obtaining a copy of this +// software and associated documentation files (the "Software"), to deal in the Software +// without restriction, including without limitation the rights to use, copy, modify, merge, +// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons +// to whom the Software is furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all copies or +// substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. + +namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty +{ + public class NamedArguments + { + public void Use(int a, int b, int c) + { + } + + public static int Get(int i) + { + return i; + } + + public void Test() + { + Use(Get(1), Get(2), Get(3)); + Use(Get(1), c: Get(2), b: Get(3)); + Use(b: Get(1), a: Get(2), c: Get(3)); + } + + public void NotNamedArgs() + { + int b = Get(1); + Use(Get(2), b, Get(3)); + } + } +} diff --git a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/NamedArguments.il b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/NamedArguments.il new file mode 100644 index 000000000..ae6d2e2a7 --- /dev/null +++ b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/NamedArguments.il @@ -0,0 +1,145 @@ + + + + +// 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 NamedArguments +{ + .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 NamedArguments.dll +.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 + + +// =============== CLASS MEMBERS DECLARATION =================== + +.class public auto ansi beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Pretty.NamedArguments + extends [mscorlib]System.Object +{ + .method public hidebysig instance void + Use(int32 a, + int32 b, + int32 c) cil managed + { + // Code size 2 (0x2) + .maxstack 8 + IL_0000: nop + IL_0001: ret + } // end of method NamedArguments::Use + + .method public hidebysig static int32 Get(int32 i) cil managed + { + // Code size 7 (0x7) + .maxstack 1 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: stloc.0 + IL_0003: br.s IL_0005 + + IL_0005: ldloc.0 + IL_0006: ret + } // end of method NamedArguments::Get + + .method public hidebysig instance void + Test() cil managed + { + // Code size 81 (0x51) + .maxstack 4 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldc.i4.1 + IL_0003: call int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NamedArguments::Get(int32) + IL_0008: ldc.i4.2 + IL_0009: call int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NamedArguments::Get(int32) + IL_000e: ldc.i4.3 + IL_000f: call int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NamedArguments::Get(int32) + IL_0014: call instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.NamedArguments::Use(int32, + int32, + int32) + IL_0019: nop + IL_001a: ldarg.0 + IL_001b: ldc.i4.1 + IL_001c: call int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NamedArguments::Get(int32) + IL_0021: ldc.i4.2 + IL_0022: call int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NamedArguments::Get(int32) + IL_0027: stloc.0 + IL_0028: ldc.i4.3 + IL_0029: call int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NamedArguments::Get(int32) + IL_002e: ldloc.0 + IL_002f: call instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.NamedArguments::Use(int32, + int32, + int32) + IL_0034: nop + IL_0035: ldarg.0 + IL_0036: ldc.i4.1 + IL_0037: call int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NamedArguments::Get(int32) + IL_003c: stloc.0 + IL_003d: ldc.i4.2 + IL_003e: call int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NamedArguments::Get(int32) + IL_0043: ldloc.0 + IL_0044: ldc.i4.3 + IL_0045: call int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NamedArguments::Get(int32) + IL_004a: call instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.NamedArguments::Use(int32, + int32, + int32) + IL_004f: nop + IL_0050: ret + } // end of method NamedArguments::Test + + .method public hidebysig instance void + NotNamedArgs() cil managed + { + // Code size 29 (0x1d) + .maxstack 4 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldc.i4.1 + IL_0002: call int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NamedArguments::Get(int32) + IL_0007: stloc.0 + IL_0008: ldarg.0 + IL_0009: ldc.i4.2 + IL_000a: call int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NamedArguments::Get(int32) + IL_000f: ldloc.0 + IL_0010: ldc.i4.3 + IL_0011: call int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NamedArguments::Get(int32) + IL_0016: call instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.NamedArguments::Use(int32, + int32, + int32) + IL_001b: nop + IL_001c: ret + } // end of method NamedArguments::NotNamedArgs + + .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 NamedArguments::.ctor + +} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.NamedArguments + + +// ============================================================= + +// *********** DISASSEMBLY COMPLETE *********************** diff --git a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/NamedArguments.opt.il b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/NamedArguments.opt.il new file mode 100644 index 000000000..efb47ca67 --- /dev/null +++ b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/NamedArguments.opt.il @@ -0,0 +1,133 @@ + + + + +// 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 NamedArguments.opt +{ + .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 NamedArguments.opt.dll +.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 + + +// =============== CLASS MEMBERS DECLARATION =================== + +.class public auto ansi beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Pretty.NamedArguments + extends [mscorlib]System.Object +{ + .method public hidebysig instance void + Use(int32 a, + int32 b, + int32 c) cil managed + { + // Code size 1 (0x1) + .maxstack 8 + IL_0000: ret + } // end of method NamedArguments::Use + + .method public hidebysig static int32 Get(int32 i) cil managed + { + // Code size 2 (0x2) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ret + } // end of method NamedArguments::Get + + .method public hidebysig instance void + Test() cil managed + { + // Code size 77 (0x4d) + .maxstack 4 + .locals init (int32 V_0, + int32 V_1) + IL_0000: ldarg.0 + IL_0001: ldc.i4.1 + IL_0002: call int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NamedArguments::Get(int32) + IL_0007: ldc.i4.2 + IL_0008: call int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NamedArguments::Get(int32) + IL_000d: ldc.i4.3 + IL_000e: call int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NamedArguments::Get(int32) + IL_0013: call instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.NamedArguments::Use(int32, + int32, + int32) + IL_0018: ldarg.0 + IL_0019: ldc.i4.1 + IL_001a: call int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NamedArguments::Get(int32) + IL_001f: ldc.i4.2 + IL_0020: call int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NamedArguments::Get(int32) + IL_0025: stloc.0 + IL_0026: ldc.i4.3 + IL_0027: call int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NamedArguments::Get(int32) + IL_002c: ldloc.0 + IL_002d: call instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.NamedArguments::Use(int32, + int32, + int32) + IL_0032: ldarg.0 + IL_0033: ldc.i4.1 + IL_0034: call int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NamedArguments::Get(int32) + IL_0039: stloc.1 + IL_003a: ldc.i4.2 + IL_003b: call int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NamedArguments::Get(int32) + IL_0040: ldloc.1 + IL_0041: ldc.i4.3 + IL_0042: call int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NamedArguments::Get(int32) + IL_0047: call instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.NamedArguments::Use(int32, + int32, + int32) + IL_004c: ret + } // end of method NamedArguments::Test + + .method public hidebysig instance void + NotNamedArgs() cil managed + { + // Code size 27 (0x1b) + .maxstack 4 + .locals init (int32 V_0) + IL_0000: ldc.i4.1 + IL_0001: call int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NamedArguments::Get(int32) + IL_0006: stloc.0 + IL_0007: ldarg.0 + IL_0008: ldc.i4.2 + IL_0009: call int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NamedArguments::Get(int32) + IL_000e: ldloc.0 + IL_000f: ldc.i4.3 + IL_0010: call int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NamedArguments::Get(int32) + IL_0015: call instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.NamedArguments::Use(int32, + int32, + int32) + IL_001a: ret + } // end of method NamedArguments::NotNamedArgs + + .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 NamedArguments::.ctor + +} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.NamedArguments + + +// ============================================================= + +// *********** DISASSEMBLY COMPLETE *********************** diff --git a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/NamedArguments.opt.roslyn.il b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/NamedArguments.opt.roslyn.il new file mode 100644 index 000000000..86b33e26d --- /dev/null +++ b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/NamedArguments.opt.roslyn.il @@ -0,0 +1,136 @@ + + + + +// 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 NamedArguments +{ + .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 NamedArguments.dll +.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 + + +// =============== CLASS MEMBERS DECLARATION =================== + +.class public auto ansi beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Pretty.NamedArguments + extends [mscorlib]System.Object +{ + .method public hidebysig instance void + Use(int32 a, + int32 b, + int32 c) cil managed + { + // Code size 1 (0x1) + .maxstack 8 + IL_0000: ret + } // end of method NamedArguments::Use + + .method public hidebysig static int32 Get(int32 i) cil managed + { + // Code size 2 (0x2) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ret + } // end of method NamedArguments::Get + + .method public hidebysig instance void + Test() cil managed + { + // Code size 77 (0x4d) + .maxstack 4 + .locals init (int32 V_0) + IL_0000: ldarg.0 + IL_0001: ldc.i4.1 + IL_0002: call int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NamedArguments::Get(int32) + IL_0007: ldc.i4.2 + IL_0008: call int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NamedArguments::Get(int32) + IL_000d: ldc.i4.3 + IL_000e: call int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NamedArguments::Get(int32) + IL_0013: call instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.NamedArguments::Use(int32, + int32, + int32) + IL_0018: ldarg.0 + IL_0019: ldc.i4.1 + IL_001a: call int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NamedArguments::Get(int32) + IL_001f: ldc.i4.2 + IL_0020: call int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NamedArguments::Get(int32) + IL_0025: stloc.0 + IL_0026: ldc.i4.3 + IL_0027: call int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NamedArguments::Get(int32) + IL_002c: ldloc.0 + IL_002d: call instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.NamedArguments::Use(int32, + int32, + int32) + IL_0032: ldarg.0 + IL_0033: ldc.i4.1 + IL_0034: call int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NamedArguments::Get(int32) + IL_0039: stloc.0 + IL_003a: ldc.i4.2 + IL_003b: call int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NamedArguments::Get(int32) + IL_0040: ldloc.0 + IL_0041: ldc.i4.3 + IL_0042: call int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NamedArguments::Get(int32) + IL_0047: call instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.NamedArguments::Use(int32, + int32, + int32) + IL_004c: ret + } // end of method NamedArguments::Test + + .method public hidebysig instance void + NotNamedArgs() cil managed + { + // Code size 27 (0x1b) + .maxstack 4 + .locals init (int32 V_0) + IL_0000: ldc.i4.1 + IL_0001: call int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NamedArguments::Get(int32) + IL_0006: stloc.0 + IL_0007: ldarg.0 + IL_0008: ldc.i4.2 + IL_0009: call int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NamedArguments::Get(int32) + IL_000e: ldloc.0 + IL_000f: ldc.i4.3 + IL_0010: call int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NamedArguments::Get(int32) + IL_0015: call instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.NamedArguments::Use(int32, + int32, + int32) + IL_001a: ret + } // end of method NamedArguments::NotNamedArgs + + .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 NamedArguments::.ctor + +} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.NamedArguments + + +// ============================================================= + +// *********** DISASSEMBLY COMPLETE *********************** diff --git a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/NamedArguments.roslyn.il b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/NamedArguments.roslyn.il new file mode 100644 index 000000000..0b3206cd4 --- /dev/null +++ b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/NamedArguments.roslyn.il @@ -0,0 +1,150 @@ + + + + +// 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 NamedArguments +{ + .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 NamedArguments.dll +.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 + + +// =============== CLASS MEMBERS DECLARATION =================== + +.class public auto ansi beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Pretty.NamedArguments + extends [mscorlib]System.Object +{ + .method public hidebysig instance void + Use(int32 a, + int32 b, + int32 c) cil managed + { + // Code size 2 (0x2) + .maxstack 8 + IL_0000: nop + IL_0001: ret + } // end of method NamedArguments::Use + + .method public hidebysig static int32 Get(int32 i) cil managed + { + // Code size 7 (0x7) + .maxstack 1 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: stloc.0 + IL_0003: br.s IL_0005 + + IL_0005: ldloc.0 + IL_0006: ret + } // end of method NamedArguments::Get + + .method public hidebysig instance void + Test() cil managed + { + // Code size 81 (0x51) + .maxstack 4 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldc.i4.1 + IL_0003: call int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NamedArguments::Get(int32) + IL_0008: ldc.i4.2 + IL_0009: call int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NamedArguments::Get(int32) + IL_000e: ldc.i4.3 + IL_000f: call int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NamedArguments::Get(int32) + IL_0014: call instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.NamedArguments::Use(int32, + int32, + int32) + IL_0019: nop + IL_001a: ldarg.0 + IL_001b: ldc.i4.1 + IL_001c: call int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NamedArguments::Get(int32) + IL_0021: ldc.i4.2 + IL_0022: call int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NamedArguments::Get(int32) + IL_0027: stloc.0 + IL_0028: ldc.i4.3 + IL_0029: call int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NamedArguments::Get(int32) + IL_002e: ldloc.0 + IL_002f: call instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.NamedArguments::Use(int32, + int32, + int32) + IL_0034: nop + IL_0035: ldarg.0 + IL_0036: ldc.i4.1 + IL_0037: call int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NamedArguments::Get(int32) + IL_003c: stloc.0 + IL_003d: ldc.i4.2 + IL_003e: call int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NamedArguments::Get(int32) + IL_0043: ldloc.0 + IL_0044: ldc.i4.3 + IL_0045: call int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NamedArguments::Get(int32) + IL_004a: call instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.NamedArguments::Use(int32, + int32, + int32) + IL_004f: nop + IL_0050: ret + } // end of method NamedArguments::Test + + .method public hidebysig instance void + NotNamedArgs() cil managed + { + // Code size 29 (0x1d) + .maxstack 4 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldc.i4.1 + IL_0002: call int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NamedArguments::Get(int32) + IL_0007: stloc.0 + IL_0008: ldarg.0 + IL_0009: ldc.i4.2 + IL_000a: call int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NamedArguments::Get(int32) + IL_000f: ldloc.0 + IL_0010: ldc.i4.3 + IL_0011: call int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NamedArguments::Get(int32) + IL_0016: call instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.NamedArguments::Use(int32, + int32, + int32) + IL_001b: nop + IL_001c: ret + } // end of method NamedArguments::NotNamedArgs + + .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 NamedArguments::.ctor + +} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.NamedArguments + + +// ============================================================= + +// *********** DISASSEMBLY COMPLETE *********************** diff --git a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/NullPropagation.cs b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/NullPropagation.cs index 5804e0624..c54de3635 100644 --- a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/NullPropagation.cs +++ b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/NullPropagation.cs @@ -1,4 +1,22 @@ -using System; +// Copyright (c) 2018 Daniel Grunwald +// +// Permission is hereby granted, free of charge, to any person obtaining a copy of this +// software and associated documentation files (the "Software"), to deal in the Software +// without restriction, including without limitation the rights to use, copy, modify, merge, +// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons +// to whom the Software is furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all copies or +// substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. + +using System; namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty {