diff --git a/ICSharpCode.Decompiler/Tests/TestCases/Pretty/AnonymousTypes.il b/ICSharpCode.Decompiler/Tests/TestCases/Pretty/AnonymousTypes.il index 6da1db0e0..c6b58a278 100644 --- a/ICSharpCode.Decompiler/Tests/TestCases/Pretty/AnonymousTypes.il +++ b/ICSharpCode.Decompiler/Tests/TestCases/Pretty/AnonymousTypes.il @@ -10,7 +10,7 @@ .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4.. .ver 4:0:0:0 } -.assembly tn2texe4 +.assembly tnrrn5wg { .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 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.module tn2texe4.dll -// MVID: {D4BB5234-2960-41DF-8B02-A927E4CEA1D0} +.module tnrrn5wg.dll +// MVID: {4CFFCB16-C703-47F9-8F30-8478576835EE} .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: 0x00860000 +// Image base: 0x00C20000 // =============== CLASS MEMBERS DECLARATION =================== diff --git a/ICSharpCode.Decompiler/Tests/TestCases/Pretty/AnonymousTypes.opt.il b/ICSharpCode.Decompiler/Tests/TestCases/Pretty/AnonymousTypes.opt.il index 34969ec05..297d072de 100644 --- a/ICSharpCode.Decompiler/Tests/TestCases/Pretty/AnonymousTypes.opt.il +++ b/ICSharpCode.Decompiler/Tests/TestCases/Pretty/AnonymousTypes.opt.il @@ -10,7 +10,7 @@ .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4.. .ver 4:0:0:0 } -.assembly ympalkau +.assembly v2lmiatb { .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 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.module ympalkau.dll -// MVID: {6272B544-8BFE-442F-9142-7052834C6BA6} +.module v2lmiatb.dll +// MVID: {9A262681-84DA-450E-9AED-ABEF96981900} .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: 0x030F0000 // =============== CLASS MEMBERS DECLARATION =================== diff --git a/ICSharpCode.Decompiler/Tests/TestCases/Pretty/Async.cs b/ICSharpCode.Decompiler/Tests/TestCases/Pretty/Async.cs index d67701b52..14571b63c 100644 --- a/ICSharpCode.Decompiler/Tests/TestCases/Pretty/Async.cs +++ b/ICSharpCode.Decompiler/Tests/TestCases/Pretty/Async.cs @@ -23,157 +23,148 @@ using System.IO; using System.Runtime.CompilerServices; using System.Threading.Tasks; -public class Async +namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty { - public async void SimpleVoidMethod() + public class Async { - Console.WriteLine("Before"); - await Task.Delay(TimeSpan.FromSeconds(1.0)); - Console.WriteLine("After"); - } - - public async void VoidMethodWithoutAwait() - { - Console.WriteLine("No Await"); - } - - public async void EmptyVoidMethod() - { - } - - public async void AwaitYield() - { - await Task.Yield(); - } - - public async void AwaitDefaultYieldAwaitable() - { - await default(YieldAwaitable); - } - - public async Task SimpleVoidTaskMethod() - { - Console.WriteLine("Before"); - await Task.Delay(TimeSpan.FromSeconds(1.0)); - Console.WriteLine("After"); - } - - public async Task TaskMethodWithoutAwait() - { - Console.WriteLine("No Await"); - } - - public async Task SimpleBoolTaskMethod() - { - Console.WriteLine("Before"); - await Task.Delay(TimeSpan.FromSeconds(1.0)); - Console.WriteLine("After"); - return true; - } - - public async void TwoAwaitsWithDifferentAwaiterTypes() - { - Console.WriteLine("Before"); - if (await this.SimpleBoolTaskMethod()) + public async void SimpleVoidMethod() { + Console.WriteLine("Before"); await Task.Delay(TimeSpan.FromSeconds(1.0)); + Console.WriteLine("After"); } - Console.WriteLine("After"); - } - - public async void StreamCopyTo(Stream destination, int bufferSize) - { - byte[] array = new byte[bufferSize]; - int count; - while ((count = await destination.ReadAsync(array, 0, array.Length)) != 0) + + public async void VoidMethodWithoutAwait() { - await destination.WriteAsync(array, 0, count); + Console.WriteLine("No Await"); } - } - - public async void StreamCopyToWithConfigureAwait(Stream destination, int bufferSize) - { - byte[] array = new byte[bufferSize]; - int count; - while ((count = await destination.ReadAsync(array, 0, array.Length).ConfigureAwait(false)) != 0) + + public async void EmptyVoidMethod() { - await destination.WriteAsync(array, 0, count).ConfigureAwait(false); } - } - - public async void AwaitInLoopCondition() - { - while (await this.SimpleBoolTaskMethod()) + + public async void AwaitYield() { - Console.WriteLine("Body"); + await Task.Yield(); } - } - - public async Task AwaitInForEach(IEnumerable> elements) - { - int num = 0; - foreach (Task current in elements) + + public async void AwaitDefaultYieldAwaitable() { - num += await current; + await default(YieldAwaitable); } - return num; - } - - public async Task TaskMethodWithoutAwaitButWithExceptionHandling() - { - try + + public async Task SimpleVoidTaskMethod() { - using (new StringWriter()) - { - Console.WriteLine("No Await"); + Console.WriteLine("Before"); + await Task.Delay(TimeSpan.FromSeconds(1.0)); + Console.WriteLine("After"); + } + + public async Task TaskMethodWithoutAwait() + { + Console.WriteLine("No Await"); + } + + public async Task SimpleBoolTaskMethod() + { + Console.WriteLine("Before"); + await Task.Delay(TimeSpan.FromSeconds(1.0)); + Console.WriteLine("After"); + return true; + } + + public async void TwoAwaitsWithDifferentAwaiterTypes() + { + Console.WriteLine("Before"); + if (await this.SimpleBoolTaskMethod()) { + await Task.Delay(TimeSpan.FromSeconds(1.0)); } - } - catch (Exception) + Console.WriteLine("After"); + } + + public async void StreamCopyTo(Stream destination, int bufferSize) { - Console.WriteLine("Crash"); + byte[] array = new byte[bufferSize]; + int count; + while ((count = await destination.ReadAsync(array, 0, array.Length)) != 0) { + await destination.WriteAsync(array, 0, count); + } } - } - public async Task AwaitCatch(Task task) - { - try { - Console.WriteLine("Before throw"); - throw new Exception(); - } catch { - Console.WriteLine(await task); + public async void StreamCopyToWithConfigureAwait(Stream destination, int bufferSize) + { + byte[] array = new byte[bufferSize]; + int count; + while ((count = await destination.ReadAsync(array, 0, array.Length).ConfigureAwait(false)) != 0) { + await destination.WriteAsync(array, 0, count).ConfigureAwait(false); + } } - } - public async Task AwaitFinally(Task task) - { - try { - Console.WriteLine("Before throw"); - throw new Exception(); - } finally { - Console.WriteLine(await task); + public async void AwaitInLoopCondition() + { + while (await this.SimpleBoolTaskMethod()) { + Console.WriteLine("Body"); + } } - } - public async Task NestedAwait(Task> task) - { - return await(await task); - } - - public async Task AwaitWithStack(Task task) - { - Console.WriteLine("A", 1, await task); - } - - public async Task AwaitWithStack2(Task task) - { - if (await this.SimpleBoolTaskMethod()) + public async Task AwaitInForEach(IEnumerable> elements) + { + int num = 0; + foreach (Task current in elements) { + num += await current; + } + return num; + } + + public async Task TaskMethodWithoutAwaitButWithExceptionHandling() + { + try { + using (new StringWriter()) { + Console.WriteLine("No Await"); + } + } catch (Exception) { + Console.WriteLine("Crash"); + } + } + + public async Task AwaitCatch(Task task) + { + try { + Console.WriteLine("Before throw"); + throw new Exception(); + } catch { + Console.WriteLine(await task); + } + } + + public async Task AwaitFinally(Task task) + { + try { + Console.WriteLine("Before throw"); + throw new Exception(); + } finally { + Console.WriteLine(await task); + } + } + + public async Task NestedAwait(Task> task) + { + return await (await task); + } + + public async Task AwaitWithStack(Task task) { Console.WriteLine("A", 1, await task); - } - else + } + + public async Task AwaitWithStack2(Task task) { - int num = 1; - Console.WriteLine("A", 1, num); + if (await this.SimpleBoolTaskMethod()) { + Console.WriteLine("A", 1, await task); + } else { + int num = 1; + Console.WriteLine("A", 1, num); + } } } -} +} \ No newline at end of file diff --git a/ICSharpCode.Decompiler/Tests/TestCases/Pretty/CompoundAssignmentTest.il b/ICSharpCode.Decompiler/Tests/TestCases/Pretty/CompoundAssignmentTest.il index 60e6f990e..04b129a99 100644 --- a/ICSharpCode.Decompiler/Tests/TestCases/Pretty/CompoundAssignmentTest.il +++ b/ICSharpCode.Decompiler/Tests/TestCases/Pretty/CompoundAssignmentTest.il @@ -1,5 +1,5 @@ -// Microsoft (R) .NET Framework IL Disassembler. Version 4.0.30319.18020 +// Microsoft (R) .NET Framework IL Disassembler. Version 4.0.30319.17929 // Copyright (c) Microsoft Corporation. All rights reserved. @@ -10,7 +10,7 @@ .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4.. .ver 4:0:0:0 } -.assembly '51dcmowd' +.assembly '140sffme' { .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 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.module '51dcmowd.dll' -// MVID: {BE23642D-B16F-447F-BA6D-BFD10D24A6FB} +.module '140sffme.dll' +// MVID: {4B912E9D-0D9D-4F78-B2A7-5F041A58B7CC} .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: 0x019B0000 +// Image base: 0x00850000 // =============== CLASS MEMBERS DECLARATION =================== diff --git a/ICSharpCode.Decompiler/Tests/TestCases/Pretty/CompoundAssignmentTest.opt.il b/ICSharpCode.Decompiler/Tests/TestCases/Pretty/CompoundAssignmentTest.opt.il index b3a02cbc9..c497a31f6 100644 --- a/ICSharpCode.Decompiler/Tests/TestCases/Pretty/CompoundAssignmentTest.opt.il +++ b/ICSharpCode.Decompiler/Tests/TestCases/Pretty/CompoundAssignmentTest.opt.il @@ -1,5 +1,5 @@ -// Microsoft (R) .NET Framework IL Disassembler. Version 4.0.30319.18020 +// Microsoft (R) .NET Framework IL Disassembler. Version 4.0.30319.17929 // Copyright (c) Microsoft Corporation. All rights reserved. @@ -10,7 +10,7 @@ .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4.. .ver 4:0:0:0 } -.assembly tz4h53ih +.assembly a1plok3m { .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 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.module tz4h53ih.dll -// MVID: {DE0CEC69-313F-43C2-8F49-A59BB6099266} +.module a1plok3m.dll +// MVID: {7BD8D57D-A1D7-460B-8B05-A3F6005A275C} .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: 0x005E0000 +// Image base: 0x01350000 // =============== CLASS MEMBERS DECLARATION =================== diff --git a/ICSharpCode.Decompiler/Tests/TestCases/Pretty/CompoundAssignmentTest.opt.roslyn.il b/ICSharpCode.Decompiler/Tests/TestCases/Pretty/CompoundAssignmentTest.opt.roslyn.il index 11b46e394..ccb81a8ab 100644 --- a/ICSharpCode.Decompiler/Tests/TestCases/Pretty/CompoundAssignmentTest.opt.roslyn.il +++ b/ICSharpCode.Decompiler/Tests/TestCases/Pretty/CompoundAssignmentTest.opt.roslyn.il @@ -1,5 +1,5 @@ -// Microsoft (R) .NET Framework IL Disassembler. Version 4.0.30319.18020 +// Microsoft (R) .NET Framework IL Disassembler. Version 4.0.30319.17929 // Copyright (c) Microsoft Corporation. All rights reserved. @@ -32,7 +32,7 @@ .stackreserve 0x00100000 .subsystem 0x0003 // WINDOWS_CUI .corflags 0x00000001 // ILONLY -// Image base: 0x00A00000 +// Image base: 0x00F40000 // =============== CLASS MEMBERS DECLARATION =================== diff --git a/ICSharpCode.Decompiler/Tests/TestCases/Pretty/CompoundAssignmentTest.roslyn.il b/ICSharpCode.Decompiler/Tests/TestCases/Pretty/CompoundAssignmentTest.roslyn.il index 202b53615..feb338eac 100644 --- a/ICSharpCode.Decompiler/Tests/TestCases/Pretty/CompoundAssignmentTest.roslyn.il +++ b/ICSharpCode.Decompiler/Tests/TestCases/Pretty/CompoundAssignmentTest.roslyn.il @@ -1,5 +1,5 @@ -// Microsoft (R) .NET Framework IL Disassembler. Version 4.0.30319.18020 +// Microsoft (R) .NET Framework IL Disassembler. Version 4.0.30319.17929 // Copyright (c) Microsoft Corporation. All rights reserved. @@ -32,7 +32,7 @@ .stackreserve 0x00100000 .subsystem 0x0003 // WINDOWS_CUI .corflags 0x00000001 // ILONLY -// Image base: 0x00EE0000 +// Image base: 0x00DA0000 // =============== CLASS MEMBERS DECLARATION =================== diff --git a/ICSharpCode.Decompiler/Tests/TestCases/Pretty/ExceptionHandling.il b/ICSharpCode.Decompiler/Tests/TestCases/Pretty/ExceptionHandling.il index bb2791c69..509dcc3cb 100644 --- a/ICSharpCode.Decompiler/Tests/TestCases/Pretty/ExceptionHandling.il +++ b/ICSharpCode.Decompiler/Tests/TestCases/Pretty/ExceptionHandling.il @@ -1,5 +1,5 @@ -// Microsoft (R) .NET Framework IL Disassembler. Version 4.0.30319.18020 +// Microsoft (R) .NET Framework IL Disassembler. Version 4.0.30319.17929 // Copyright (c) Microsoft Corporation. All rights reserved. @@ -10,7 +10,7 @@ .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4.. .ver 4:0:0:0 } -.assembly cjszwdil +.assembly gqt5jzz5 { .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 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.module cjszwdil.dll -// MVID: {7ED95804-37F9-435D-95FF-BCC0F9019DEB} +.module gqt5jzz5.dll +// MVID: {1567B13E-0DA5-4C78-90CC-FF153FC2F5EA} .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: 0x00E00000 +// Image base: 0x017B0000 // =============== CLASS MEMBERS DECLARATION =================== diff --git a/ICSharpCode.Decompiler/Tests/TestCases/Pretty/ExceptionHandling.opt.il b/ICSharpCode.Decompiler/Tests/TestCases/Pretty/ExceptionHandling.opt.il index 8891de0e5..53ca25964 100644 --- a/ICSharpCode.Decompiler/Tests/TestCases/Pretty/ExceptionHandling.opt.il +++ b/ICSharpCode.Decompiler/Tests/TestCases/Pretty/ExceptionHandling.opt.il @@ -1,5 +1,5 @@ -// Microsoft (R) .NET Framework IL Disassembler. Version 4.0.30319.18020 +// Microsoft (R) .NET Framework IL Disassembler. Version 4.0.30319.17929 // Copyright (c) Microsoft Corporation. All rights reserved. @@ -10,7 +10,7 @@ .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4.. .ver 4:0:0:0 } -.assembly cl4g010y +.assembly o1rsjnei { .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 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.module cl4g010y.dll -// MVID: {2A833493-111C-42B3-BEC8-7DD8D84E816F} +.module o1rsjnei.dll +// MVID: {B8D4207B-6DCF-46D1-AF73-74B4CDFFDE2A} .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: 0x01160000 +// Image base: 0x01800000 // =============== CLASS MEMBERS DECLARATION =================== diff --git a/ICSharpCode.Decompiler/Tests/TestCases/Pretty/HelloWorld.cs b/ICSharpCode.Decompiler/Tests/TestCases/Pretty/HelloWorld.cs index 5aa7172be..38304c3d5 100644 --- a/ICSharpCode.Decompiler/Tests/TestCases/Pretty/HelloWorld.cs +++ b/ICSharpCode.Decompiler/Tests/TestCases/Pretty/HelloWorld.cs @@ -18,7 +18,7 @@ using System; -namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty.HelloWorld +namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty { public class HelloWorld { diff --git a/ICSharpCode.Decompiler/Tests/TestCases/Pretty/HelloWorld.il b/ICSharpCode.Decompiler/Tests/TestCases/Pretty/HelloWorld.il index 243d1e39b..e4562f2a0 100644 --- a/ICSharpCode.Decompiler/Tests/TestCases/Pretty/HelloWorld.il +++ b/ICSharpCode.Decompiler/Tests/TestCases/Pretty/HelloWorld.il @@ -1,5 +1,5 @@ -// Microsoft (R) .NET Framework IL Disassembler. Version 4.0.30319.18020 +// Microsoft (R) .NET Framework IL Disassembler. Version 4.0.30319.17929 // Copyright (c) Microsoft Corporation. All rights reserved. @@ -10,7 +10,7 @@ .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4.. .ver 4:0:0:0 } -.assembly k1t5kqf4 +.assembly '5iai3vtm' { .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,20 +20,20 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.module k1t5kqf4.dll -// MVID: {E5E22476-66BF-4224-B0B7-8B8B07971677} +.module '5iai3vtm.dll' +// MVID: {66BA676E-A1AF-4531-9C09-198436A0A184} .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: 0x00B10000 +// Image base: 0x00CC0000 // =============== CLASS MEMBERS DECLARATION =================== -.class public auto ansi beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Pretty.HelloWorld.HelloWorld +.class public auto ansi beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Pretty.HelloWorld extends [mscorlib]System.Object { .method public hidebysig static void Main() cil managed @@ -57,7 +57,7 @@ IL_0006: ret } // end of method HelloWorld::.ctor -} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.HelloWorld.HelloWorld +} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.HelloWorld // ============================================================= diff --git a/ICSharpCode.Decompiler/Tests/TestCases/Pretty/InlineAssignmentTest.il b/ICSharpCode.Decompiler/Tests/TestCases/Pretty/InlineAssignmentTest.il index b75f536a6..e0920cdba 100644 --- a/ICSharpCode.Decompiler/Tests/TestCases/Pretty/InlineAssignmentTest.il +++ b/ICSharpCode.Decompiler/Tests/TestCases/Pretty/InlineAssignmentTest.il @@ -1,5 +1,5 @@ -// Microsoft (R) .NET Framework IL Disassembler. Version 4.0.30319.18020 +// Microsoft (R) .NET Framework IL Disassembler. Version 4.0.30319.17929 // Copyright (c) Microsoft Corporation. All rights reserved. @@ -10,7 +10,7 @@ .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4.. .ver 4:0:0:0 } -.assembly ibag1kve +.assembly xh5er5kd { .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 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.module ibag1kve.dll -// MVID: {C798271E-70DB-47E6-B4B1-8CCE369C32D9} +.module xh5er5kd.dll +// MVID: {9DBFA28B-BEE8-4796-A203-E73267B1357D} .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: 0x01380000 +// Image base: 0x023E0000 // =============== CLASS MEMBERS DECLARATION =================== diff --git a/ICSharpCode.Decompiler/Tests/TestCases/Pretty/InlineAssignmentTest.opt.il b/ICSharpCode.Decompiler/Tests/TestCases/Pretty/InlineAssignmentTest.opt.il index ec9c1ff78..da60ad226 100644 --- a/ICSharpCode.Decompiler/Tests/TestCases/Pretty/InlineAssignmentTest.opt.il +++ b/ICSharpCode.Decompiler/Tests/TestCases/Pretty/InlineAssignmentTest.opt.il @@ -1,5 +1,5 @@ -// Microsoft (R) .NET Framework IL Disassembler. Version 4.0.30319.18020 +// Microsoft (R) .NET Framework IL Disassembler. Version 4.0.30319.17929 // Copyright (c) Microsoft Corporation. All rights reserved. @@ -10,7 +10,7 @@ .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4.. .ver 4:0:0:0 } -.assembly apcrd50s +.assembly b1jpssom { .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 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.module apcrd50s.dll -// MVID: {2884A62F-51BC-4EC0-B257-046D0505426A} +.module b1jpssom.dll +// MVID: {7C6502B0-8536-4BED-9395-765EB2F77653} .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: 0x02680000 +// Image base: 0x02B00000 // =============== CLASS MEMBERS DECLARATION =================== diff --git a/ICSharpCode.Decompiler/Tests/TestCases/Pretty/Loops.cs b/ICSharpCode.Decompiler/Tests/TestCases/Pretty/Loops.cs index 540b94fa3..69874cabb 100644 --- a/ICSharpCode.Decompiler/Tests/TestCases/Pretty/Loops.cs +++ b/ICSharpCode.Decompiler/Tests/TestCases/Pretty/Loops.cs @@ -20,185 +20,182 @@ using System; using System.Collections; using System.Collections.Generic; -public class Loops +namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty { - public void ForEach(IEnumerable enumerable) + public class Loops { - foreach (string current in enumerable) + public void ForEach(IEnumerable enumerable) { - current.ToLower(); + foreach (string current in enumerable) { + current.ToLower(); + } } - } - - public void ForEachOverList(List list) - { - // List has a struct as enumerator, so produces quite different IL than foreach over the IEnumerable interface - foreach (string current in list) + + public void ForEachOverList(List list) { - current.ToLower(); + // List has a struct as enumerator, so produces quite different IL than foreach over the IEnumerable interface + foreach (string current in list) { + current.ToLower(); + } } - } - - public void ForEachOverNonGenericEnumerable(IEnumerable enumerable) - { - foreach (object current in enumerable) + + public void ForEachOverNonGenericEnumerable(IEnumerable enumerable) { - current.ToString(); + foreach (object current in enumerable) { + current.ToString(); + } } - } - - public void ForEachOverNonGenericEnumerableWithAutomaticCast(IEnumerable enumerable) - { - foreach (int num in enumerable) + + public void ForEachOverNonGenericEnumerableWithAutomaticCast(IEnumerable enumerable) { - num.ToString(); + foreach (int num in enumerable) { + num.ToString(); + } } - } - -// public void ForEachOverArray(string[] array) -// { -// foreach (string text in array) -// { -// text.ToLower(); -// } -// } - - public void ForOverArray(string[] array) - { - for (int i = 0; i < array.Length; i++) + + // public void ForEachOverArray(string[] array) + // { + // foreach (string text in array) + // { + // text.ToLower(); + // } + // } + + public void ForOverArray(string[] array) { - array[i].ToLower(); + for (int i = 0; i < array.Length; i++) { + array[i].ToLower(); + } } - } - - public void NestedLoops() - { - for (int i = 0; i < 10; i++) { - if (i % 2 == 0) { - for (int j = 0; j < 5; j++) { - Console.WriteLine("Y"); + + public void NestedLoops() + { + for (int i = 0; i < 10; i++) { + if (i % 2 == 0) { + for (int j = 0; j < 5; j++) { + Console.WriteLine("Y"); + } + } else { + Console.WriteLine("X"); } - } else { - Console.WriteLine("X"); } } - } - - public int MultipleExits() - { - int i = 0; - while (true) { - if (i % 4 == 0) { return 4; } - if (i % 7 == 0) { break; } - if (i % 9 == 0) { return 5; } - if (i % 11 == 0) { break; } - i++; - } - i = int.MinValue; - return i; - } - - public int InterestingLoop() - { - int i = 0; - if (i % 11 == 0) { + + public int MultipleExits() + { + int i = 0; while (true) { - if (i % 4 == 0) { - if (i % 7 == 0) { - if (i % 11 == 0) { - continue; // use a continue here to prevent moving the if (i%7) outside the loop - } - Console.WriteLine("7"); - } else { - // this block is not part of the natural loop - Console.WriteLine("!7"); - } - break; - } + if (i % 4 == 0) { return 4; } + if (i % 7 == 0) { break; } + if (i % 9 == 0) { return 5; } + if (i % 11 == 0) { break; } i++; } - // This instruction is still dominated by the loop header i = int.MinValue; + return i; } - return i; - } - - bool Condition(string arg) - { - Console.WriteLine("Condition: " + arg); - return false; - } - - public void WhileLoop() - { - Console.WriteLine("Initial"); - if (Condition("if")) { - while (Condition("while")) { - Console.WriteLine("Loop Body"); - if (Condition("test")) { - if (Condition("continue")) - continue; - if (!Condition("break")) + + public int InterestingLoop() + { + int i = 0; + if (i % 11 == 0) { + while (true) { + if (i % 4 == 0) { + if (i % 7 == 0) { + if (i % 11 == 0) { + continue; // use a continue here to prevent moving the if (i%7) outside the loop + } + Console.WriteLine("7"); + } else { + // this block is not part of the natural loop + Console.WriteLine("!7"); + } break; + } + i++; } - Console.WriteLine("End of loop body"); + // This instruction is still dominated by the loop header + i = int.MinValue; } - Console.WriteLine("After loop"); + return i; } - Console.WriteLine("End of method"); - } - public void WhileWithGoto() - { - while (Condition("Main Loop")) { - if (!Condition("Condition")) - goto block2; - block1: - Console.WriteLine("Block1"); - if (Condition("Condition2")) - continue; - block2: - Console.WriteLine("Block2"); - goto block1; + bool Condition(string arg) + { + Console.WriteLine("Condition: " + arg); + return false; } - } - - public void DoWhileLoop() - { - Console.WriteLine("Initial"); - if (Condition("if")) { - do { - Console.WriteLine("Loop Body"); - if (Condition("test")) { - if (Condition("continue")) - continue; - if (!Condition("break")) - break; + + public void WhileLoop() + { + Console.WriteLine("Initial"); + if (Condition("if")) { + while (Condition("while")) { + Console.WriteLine("Loop Body"); + if (Condition("test")) { + if (Condition("continue")) + continue; + if (!Condition("break")) + break; + } + Console.WriteLine("End of loop body"); } - Console.WriteLine("End of loop body"); - } while (Condition("while")); - Console.WriteLine("After loop"); + Console.WriteLine("After loop"); + } + Console.WriteLine("End of method"); } - Console.WriteLine("End of method"); - } - - public void ForLoop() - { - Console.WriteLine("Initial"); - if (Condition("if")) { - for (int i = 0; Condition("for"); i++) { - Console.WriteLine("Loop Body"); - if (Condition("test")) { - if (Condition("continue")) - continue; - if (!Condition("break")) - break; + + public void WhileWithGoto() + { + while (Condition("Main Loop")) { + if (!Condition("Condition")) + goto block2; + block1: + Console.WriteLine("Block1"); + if (Condition("Condition2")) + continue; + block2: + Console.WriteLine("Block2"); + goto block1; + } + } + + public void DoWhileLoop() + { + Console.WriteLine("Initial"); + if (Condition("if")) { + do { + Console.WriteLine("Loop Body"); + if (Condition("test")) { + if (Condition("continue")) + continue; + if (!Condition("break")) + break; + } + Console.WriteLine("End of loop body"); + } while (Condition("while")); + Console.WriteLine("After loop"); + } + Console.WriteLine("End of method"); + } + + public void ForLoop() + { + Console.WriteLine("Initial"); + if (Condition("if")) { + for (int i = 0; Condition("for"); i++) { + Console.WriteLine("Loop Body"); + if (Condition("test")) { + if (Condition("continue")) + continue; + if (!Condition("break")) + break; + } + Console.WriteLine("End of loop body"); } - Console.WriteLine("End of loop body"); + Console.WriteLine("After loop"); } - Console.WriteLine("After loop"); + Console.WriteLine("End of method"); } - Console.WriteLine("End of method"); } } - diff --git a/ICSharpCode.Decompiler/Tests/TestCases/Pretty/Loops.il b/ICSharpCode.Decompiler/Tests/TestCases/Pretty/Loops.il deleted file mode 100644 index fee48d95d..000000000 --- a/ICSharpCode.Decompiler/Tests/TestCases/Pretty/Loops.il +++ /dev/null @@ -1,820 +0,0 @@ - -// 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 plngalwy -{ - .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 plngalwy.dll -// MVID: {0E13F4FD-6735-4D69-893B-CE3CD5A7D290} -.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: 0x00B70000 - - -// =============== CLASS MEMBERS DECLARATION =================== - -.class public auto ansi beforefieldinit Loops - extends [mscorlib]System.Object -{ - .method public hidebysig instance void - ForEach(class [mscorlib]System.Collections.Generic.IEnumerable`1 enumerable) cil managed - { - // Code size 57 (0x39) - .maxstack 2 - .locals init (string V_0, - class [mscorlib]System.Collections.Generic.IEnumerator`1 V_1, - bool V_2) - IL_0000: nop - IL_0001: nop - IL_0002: ldarg.1 - IL_0003: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerator`1 class [mscorlib]System.Collections.Generic.IEnumerable`1::GetEnumerator() - IL_0008: stloc.1 - .try - { - IL_0009: br.s IL_001b - - IL_000b: ldloc.1 - IL_000c: callvirt instance !0 class [mscorlib]System.Collections.Generic.IEnumerator`1::get_Current() - IL_0011: stloc.0 - IL_0012: nop - IL_0013: ldloc.0 - IL_0014: callvirt instance string [mscorlib]System.String::ToLower() - IL_0019: pop - IL_001a: nop - IL_001b: ldloc.1 - IL_001c: callvirt instance bool [mscorlib]System.Collections.IEnumerator::MoveNext() - IL_0021: stloc.2 - IL_0022: ldloc.2 - IL_0023: brtrue.s IL_000b - - IL_0025: leave.s IL_0037 - - } // end .try - finally - { - IL_0027: ldloc.1 - IL_0028: ldnull - IL_0029: ceq - IL_002b: stloc.2 - IL_002c: ldloc.2 - IL_002d: brtrue.s IL_0036 - - IL_002f: ldloc.1 - IL_0030: callvirt instance void [mscorlib]System.IDisposable::Dispose() - IL_0035: nop - IL_0036: endfinally - } // end handler - IL_0037: nop - IL_0038: ret - } // end of method Loops::ForEach - - .method public hidebysig instance void - ForEachOverList(class [mscorlib]System.Collections.Generic.List`1 list) cil managed - { - // Code size 58 (0x3a) - .maxstack 1 - .locals init (string V_0, - valuetype [mscorlib]System.Collections.Generic.List`1/Enumerator V_1, - bool V_2) - IL_0000: nop - IL_0001: nop - IL_0002: ldarg.1 - IL_0003: callvirt instance valuetype [mscorlib]System.Collections.Generic.List`1/Enumerator class [mscorlib]System.Collections.Generic.List`1::GetEnumerator() - IL_0008: stloc.1 - .try - { - IL_0009: br.s IL_001c - - IL_000b: ldloca.s V_1 - IL_000d: call instance !0 valuetype [mscorlib]System.Collections.Generic.List`1/Enumerator::get_Current() - IL_0012: stloc.0 - IL_0013: nop - IL_0014: ldloc.0 - IL_0015: callvirt instance string [mscorlib]System.String::ToLower() - IL_001a: pop - IL_001b: nop - IL_001c: ldloca.s V_1 - IL_001e: call instance bool valuetype [mscorlib]System.Collections.Generic.List`1/Enumerator::MoveNext() - IL_0023: stloc.2 - IL_0024: ldloc.2 - IL_0025: brtrue.s IL_000b - - IL_0027: leave.s IL_0038 - - } // end .try - finally - { - IL_0029: ldloca.s V_1 - IL_002b: constrained. valuetype [mscorlib]System.Collections.Generic.List`1/Enumerator - IL_0031: callvirt instance void [mscorlib]System.IDisposable::Dispose() - IL_0036: nop - IL_0037: endfinally - } // end handler - IL_0038: nop - IL_0039: ret - } // end of method Loops::ForEachOverList - - .method public hidebysig instance void - ForEachOverNonGenericEnumerable(class [mscorlib]System.Collections.IEnumerable enumerable) cil managed - { - // Code size 64 (0x40) - .maxstack 2 - .locals init (object V_0, - class [mscorlib]System.Collections.IEnumerator V_1, - bool V_2, - class [mscorlib]System.IDisposable V_3) - IL_0000: nop - IL_0001: nop - IL_0002: ldarg.1 - IL_0003: callvirt instance class [mscorlib]System.Collections.IEnumerator [mscorlib]System.Collections.IEnumerable::GetEnumerator() - IL_0008: stloc.1 - .try - { - IL_0009: br.s IL_001b - - IL_000b: ldloc.1 - IL_000c: callvirt instance object [mscorlib]System.Collections.IEnumerator::get_Current() - IL_0011: stloc.0 - IL_0012: nop - IL_0013: ldloc.0 - IL_0014: callvirt instance string [mscorlib]System.Object::ToString() - IL_0019: pop - IL_001a: nop - IL_001b: ldloc.1 - IL_001c: callvirt instance bool [mscorlib]System.Collections.IEnumerator::MoveNext() - IL_0021: stloc.2 - IL_0022: ldloc.2 - IL_0023: brtrue.s IL_000b - - IL_0025: leave.s IL_003e - - } // end .try - finally - { - IL_0027: ldloc.1 - IL_0028: isinst [mscorlib]System.IDisposable - IL_002d: stloc.3 - IL_002e: ldloc.3 - IL_002f: ldnull - IL_0030: ceq - IL_0032: stloc.2 - IL_0033: ldloc.2 - IL_0034: brtrue.s IL_003d - - IL_0036: ldloc.3 - IL_0037: callvirt instance void [mscorlib]System.IDisposable::Dispose() - IL_003c: nop - IL_003d: endfinally - } // end handler - IL_003e: nop - IL_003f: ret - } // end of method Loops::ForEachOverNonGenericEnumerable - - .method public hidebysig instance void - ForEachOverNonGenericEnumerableWithAutomaticCast(class [mscorlib]System.Collections.IEnumerable enumerable) cil managed - { - // Code size 70 (0x46) - .maxstack 2 - .locals init (int32 V_0, - class [mscorlib]System.Collections.IEnumerator V_1, - bool V_2, - class [mscorlib]System.IDisposable V_3) - IL_0000: nop - IL_0001: nop - IL_0002: ldarg.1 - IL_0003: callvirt instance class [mscorlib]System.Collections.IEnumerator [mscorlib]System.Collections.IEnumerable::GetEnumerator() - IL_0008: stloc.1 - .try - { - IL_0009: br.s IL_0021 - - IL_000b: ldloc.1 - IL_000c: callvirt instance object [mscorlib]System.Collections.IEnumerator::get_Current() - IL_0011: unbox.any [mscorlib]System.Int32 - IL_0016: stloc.0 - IL_0017: nop - IL_0018: ldloca.s V_0 - IL_001a: call instance string [mscorlib]System.Int32::ToString() - IL_001f: pop - IL_0020: nop - IL_0021: ldloc.1 - IL_0022: callvirt instance bool [mscorlib]System.Collections.IEnumerator::MoveNext() - IL_0027: stloc.2 - IL_0028: ldloc.2 - IL_0029: brtrue.s IL_000b - - IL_002b: leave.s IL_0044 - - } // end .try - finally - { - IL_002d: ldloc.1 - IL_002e: isinst [mscorlib]System.IDisposable - IL_0033: stloc.3 - IL_0034: ldloc.3 - IL_0035: ldnull - IL_0036: ceq - IL_0038: stloc.2 - IL_0039: ldloc.2 - IL_003a: brtrue.s IL_0043 - - IL_003c: ldloc.3 - IL_003d: callvirt instance void [mscorlib]System.IDisposable::Dispose() - IL_0042: nop - IL_0043: endfinally - } // end handler - IL_0044: nop - IL_0045: ret - } // end of method Loops::ForEachOverNonGenericEnumerableWithAutomaticCast - - .method public hidebysig instance void - ForOverArray(string[] 'array') cil managed - { - // Code size 31 (0x1f) - .maxstack 2 - .locals init (int32 V_0, - bool V_1) - IL_0000: nop - IL_0001: ldc.i4.0 - IL_0002: stloc.0 - IL_0003: br.s IL_0014 - - IL_0005: nop - IL_0006: ldarg.1 - IL_0007: ldloc.0 - IL_0008: ldelem.ref - IL_0009: callvirt instance string [mscorlib]System.String::ToLower() - IL_000e: pop - IL_000f: nop - IL_0010: ldloc.0 - IL_0011: ldc.i4.1 - IL_0012: add - IL_0013: stloc.0 - IL_0014: ldloc.0 - IL_0015: ldarg.1 - IL_0016: ldlen - IL_0017: conv.i4 - IL_0018: clt - IL_001a: stloc.1 - IL_001b: ldloc.1 - IL_001c: brtrue.s IL_0005 - - IL_001e: ret - } // end of method Loops::ForOverArray - - .method public hidebysig instance void - NestedLoops() cil managed - { - // Code size 80 (0x50) - .maxstack 2 - .locals init (int32 V_0, - int32 V_1, - bool V_2) - IL_0000: nop - IL_0001: ldc.i4.0 - IL_0002: stloc.0 - IL_0003: br.s IL_0046 - - IL_0005: nop - IL_0006: ldloc.0 - IL_0007: ldc.i4.2 - IL_0008: rem - IL_0009: ldc.i4.0 - IL_000a: ceq - IL_000c: ldc.i4.0 - IL_000d: ceq - IL_000f: stloc.2 - IL_0010: ldloc.2 - IL_0011: brtrue.s IL_0034 - - IL_0013: nop - IL_0014: ldc.i4.0 - IL_0015: stloc.1 - IL_0016: br.s IL_0029 - - IL_0018: nop - IL_0019: ldstr "Y" - IL_001e: call void [mscorlib]System.Console::WriteLine(string) - IL_0023: nop - IL_0024: nop - IL_0025: ldloc.1 - IL_0026: ldc.i4.1 - IL_0027: add - IL_0028: stloc.1 - IL_0029: ldloc.1 - IL_002a: ldc.i4.5 - IL_002b: clt - IL_002d: stloc.2 - IL_002e: ldloc.2 - IL_002f: brtrue.s IL_0018 - - IL_0031: nop - IL_0032: br.s IL_0041 - - IL_0034: nop - IL_0035: ldstr "X" - IL_003a: call void [mscorlib]System.Console::WriteLine(string) - IL_003f: nop - IL_0040: nop - IL_0041: nop - IL_0042: ldloc.0 - IL_0043: ldc.i4.1 - IL_0044: add - IL_0045: stloc.0 - IL_0046: ldloc.0 - IL_0047: ldc.i4.s 10 - IL_0049: clt - IL_004b: stloc.2 - IL_004c: ldloc.2 - IL_004d: brtrue.s IL_0005 - - IL_004f: ret - } // end of method Loops::NestedLoops - - .method public hidebysig instance int32 - MultipleExits() cil managed - { - // Code size 97 (0x61) - .maxstack 2 - .locals init (int32 V_0, - int32 V_1, - bool V_2) - IL_0000: nop - IL_0001: ldc.i4.0 - IL_0002: stloc.0 - IL_0003: br.s IL_0051 - - IL_0005: nop - IL_0006: ldloc.0 - IL_0007: ldc.i4.4 - IL_0008: rem - IL_0009: ldc.i4.0 - IL_000a: ceq - IL_000c: ldc.i4.0 - IL_000d: ceq - IL_000f: stloc.2 - IL_0010: ldloc.2 - IL_0011: brtrue.s IL_0018 - - IL_0013: nop - IL_0014: ldc.i4.4 - IL_0015: stloc.1 - IL_0016: br.s IL_005f - - IL_0018: ldloc.0 - IL_0019: ldc.i4.7 - IL_001a: rem - IL_001b: ldc.i4.0 - IL_001c: ceq - IL_001e: ldc.i4.0 - IL_001f: ceq - IL_0021: stloc.2 - IL_0022: ldloc.2 - IL_0023: brtrue.s IL_0028 - - IL_0025: nop - IL_0026: br.s IL_0055 - - IL_0028: ldloc.0 - IL_0029: ldc.i4.s 9 - IL_002b: rem - IL_002c: ldc.i4.0 - IL_002d: ceq - IL_002f: ldc.i4.0 - IL_0030: ceq - IL_0032: stloc.2 - IL_0033: ldloc.2 - IL_0034: brtrue.s IL_003b - - IL_0036: nop - IL_0037: ldc.i4.5 - IL_0038: stloc.1 - IL_0039: br.s IL_005f - - IL_003b: ldloc.0 - IL_003c: ldc.i4.s 11 - IL_003e: rem - IL_003f: ldc.i4.0 - IL_0040: ceq - IL_0042: ldc.i4.0 - IL_0043: ceq - IL_0045: stloc.2 - IL_0046: ldloc.2 - IL_0047: brtrue.s IL_004c - - IL_0049: nop - IL_004a: br.s IL_0055 - - IL_004c: ldloc.0 - IL_004d: ldc.i4.1 - IL_004e: add - IL_004f: stloc.0 - IL_0050: nop - IL_0051: ldc.i4.1 - IL_0052: stloc.2 - IL_0053: br.s IL_0005 - - IL_0055: ldc.i4 0x80000000 - IL_005a: stloc.0 - IL_005b: ldloc.0 - IL_005c: stloc.1 - IL_005d: br.s IL_005f - - IL_005f: ldloc.1 - IL_0060: ret - } // end of method Loops::MultipleExits - - .method public hidebysig instance int32 - InterestingLoop() cil managed - { - // Code size 117 (0x75) - .maxstack 2 - .locals init (int32 V_0, - int32 V_1, - bool V_2) - IL_0000: nop - IL_0001: ldc.i4.0 - IL_0002: stloc.0 - IL_0003: ldloc.0 - IL_0004: ldc.i4.s 11 - IL_0006: rem - IL_0007: ldc.i4.0 - IL_0008: ceq - IL_000a: ldc.i4.0 - IL_000b: ceq - IL_000d: stloc.2 - IL_000e: ldloc.2 - IL_000f: brtrue.s IL_006f - - IL_0011: nop - IL_0012: br.s IL_0064 - - IL_0014: nop - IL_0015: ldloc.0 - IL_0016: ldc.i4.4 - IL_0017: rem - IL_0018: ldc.i4.0 - IL_0019: ceq - IL_001b: ldc.i4.0 - IL_001c: ceq - IL_001e: stloc.2 - IL_001f: ldloc.2 - IL_0020: brtrue.s IL_005f - - IL_0022: nop - IL_0023: ldloc.0 - IL_0024: ldc.i4.7 - IL_0025: rem - IL_0026: ldc.i4.0 - IL_0027: ceq - IL_0029: ldc.i4.0 - IL_002a: ceq - IL_002c: stloc.2 - IL_002d: ldloc.2 - IL_002e: brtrue.s IL_0050 - - IL_0030: nop - IL_0031: ldloc.0 - IL_0032: ldc.i4.s 11 - IL_0034: rem - IL_0035: ldc.i4.0 - IL_0036: ceq - IL_0038: ldc.i4.0 - IL_0039: ceq - IL_003b: stloc.2 - IL_003c: ldloc.2 - IL_003d: brtrue.s IL_0042 - - IL_003f: nop - IL_0040: br.s IL_0064 - - IL_0042: ldstr "7" - IL_0047: call void [mscorlib]System.Console::WriteLine(string) - IL_004c: nop - IL_004d: nop - IL_004e: br.s IL_005d - - IL_0050: nop - IL_0051: ldstr "!7" - IL_0056: call void [mscorlib]System.Console::WriteLine(string) - IL_005b: nop - IL_005c: nop - IL_005d: br.s IL_0068 - - IL_005f: ldloc.0 - IL_0060: ldc.i4.1 - IL_0061: add - IL_0062: stloc.0 - IL_0063: nop - IL_0064: ldc.i4.1 - IL_0065: stloc.2 - IL_0066: br.s IL_0014 - - IL_0068: ldc.i4 0x80000000 - IL_006d: stloc.0 - IL_006e: nop - IL_006f: ldloc.0 - IL_0070: stloc.1 - IL_0071: br.s IL_0073 - - IL_0073: ldloc.1 - IL_0074: ret - } // end of method Loops::InterestingLoop - - .method private hidebysig instance bool - Condition(string arg) cil managed - { - // Code size 24 (0x18) - .maxstack 2 - .locals init (bool V_0) - IL_0000: nop - IL_0001: ldstr "Condition: " - IL_0006: ldarg.1 - IL_0007: call string [mscorlib]System.String::Concat(string, - string) - IL_000c: call void [mscorlib]System.Console::WriteLine(string) - IL_0011: nop - IL_0012: ldc.i4.0 - IL_0013: stloc.0 - IL_0014: br.s IL_0016 - - IL_0016: ldloc.0 - IL_0017: ret - } // end of method Loops::Condition - - .method public hidebysig instance void - WhileLoop() cil managed - { - // Code size 153 (0x99) - .maxstack 2 - .locals init (bool V_0) - IL_0000: nop - IL_0001: ldstr "Initial" - IL_0006: call void [mscorlib]System.Console::WriteLine(string) - IL_000b: nop - IL_000c: ldarg.0 - IL_000d: ldstr "if" - IL_0012: call instance bool Loops::Condition(string) - IL_0017: ldc.i4.0 - IL_0018: ceq - IL_001a: stloc.0 - IL_001b: ldloc.0 - IL_001c: brtrue.s IL_008d - - IL_001e: nop - IL_001f: br.s IL_0072 - - IL_0021: nop - IL_0022: ldstr "Loop Body" - IL_0027: call void [mscorlib]System.Console::WriteLine(string) - IL_002c: nop - IL_002d: ldarg.0 - IL_002e: ldstr "test" - IL_0033: call instance bool Loops::Condition(string) - IL_0038: ldc.i4.0 - IL_0039: ceq - IL_003b: stloc.0 - IL_003c: ldloc.0 - IL_003d: brtrue.s IL_0066 - - IL_003f: nop - IL_0040: ldarg.0 - IL_0041: ldstr "continue" - IL_0046: call instance bool Loops::Condition(string) - IL_004b: ldc.i4.0 - IL_004c: ceq - IL_004e: stloc.0 - IL_004f: ldloc.0 - IL_0050: brtrue.s IL_0054 - - IL_0052: br.s IL_0072 - - IL_0054: ldarg.0 - IL_0055: ldstr "break" - IL_005a: call instance bool Loops::Condition(string) - IL_005f: stloc.0 - IL_0060: ldloc.0 - IL_0061: brtrue.s IL_0065 - - IL_0063: br.s IL_0081 - - IL_0065: nop - IL_0066: ldstr "End of loop body" - IL_006b: call void [mscorlib]System.Console::WriteLine(string) - IL_0070: nop - IL_0071: nop - IL_0072: ldarg.0 - IL_0073: ldstr "while" - IL_0078: call instance bool Loops::Condition(string) - IL_007d: stloc.0 - IL_007e: ldloc.0 - IL_007f: brtrue.s IL_0021 - - IL_0081: ldstr "After loop" - IL_0086: call void [mscorlib]System.Console::WriteLine(string) - IL_008b: nop - IL_008c: nop - IL_008d: ldstr "End of method" - IL_0092: call void [mscorlib]System.Console::WriteLine(string) - IL_0097: nop - IL_0098: ret - } // end of method Loops::WhileLoop - - .method public hidebysig instance void - DoWhileLoop() cil managed - { - // Code size 151 (0x97) - .maxstack 2 - .locals init (bool V_0) - IL_0000: nop - IL_0001: ldstr "Initial" - IL_0006: call void [mscorlib]System.Console::WriteLine(string) - IL_000b: nop - IL_000c: ldarg.0 - IL_000d: ldstr "if" - IL_0012: call instance bool Loops::Condition(string) - IL_0017: ldc.i4.0 - IL_0018: ceq - IL_001a: stloc.0 - IL_001b: ldloc.0 - IL_001c: brtrue.s IL_008b - - IL_001e: nop - IL_001f: nop - IL_0020: ldstr "Loop Body" - IL_0025: call void [mscorlib]System.Console::WriteLine(string) - IL_002a: nop - IL_002b: ldarg.0 - IL_002c: ldstr "test" - IL_0031: call instance bool Loops::Condition(string) - IL_0036: ldc.i4.0 - IL_0037: ceq - IL_0039: stloc.0 - IL_003a: ldloc.0 - IL_003b: brtrue.s IL_0064 - - IL_003d: nop - IL_003e: ldarg.0 - IL_003f: ldstr "continue" - IL_0044: call instance bool Loops::Condition(string) - IL_0049: ldc.i4.0 - IL_004a: ceq - IL_004c: stloc.0 - IL_004d: ldloc.0 - IL_004e: brtrue.s IL_0052 - - IL_0050: br.s IL_0070 - - IL_0052: ldarg.0 - IL_0053: ldstr "break" - IL_0058: call instance bool Loops::Condition(string) - IL_005d: stloc.0 - IL_005e: ldloc.0 - IL_005f: brtrue.s IL_0063 - - IL_0061: br.s IL_007f - - IL_0063: nop - IL_0064: ldstr "End of loop body" - IL_0069: call void [mscorlib]System.Console::WriteLine(string) - IL_006e: nop - IL_006f: nop - IL_0070: ldarg.0 - IL_0071: ldstr "while" - IL_0076: call instance bool Loops::Condition(string) - IL_007b: stloc.0 - IL_007c: ldloc.0 - IL_007d: brtrue.s IL_001f - - IL_007f: ldstr "After loop" - IL_0084: call void [mscorlib]System.Console::WriteLine(string) - IL_0089: nop - IL_008a: nop - IL_008b: ldstr "End of method" - IL_0090: call void [mscorlib]System.Console::WriteLine(string) - IL_0095: nop - IL_0096: ret - } // end of method Loops::DoWhileLoop - - .method public hidebysig instance void - ForLoop() cil managed - { - // Code size 159 (0x9f) - .maxstack 2 - .locals init (int32 V_0, - bool V_1) - IL_0000: nop - IL_0001: ldstr "Initial" - IL_0006: call void [mscorlib]System.Console::WriteLine(string) - IL_000b: nop - IL_000c: ldarg.0 - IL_000d: ldstr "if" - IL_0012: call instance bool Loops::Condition(string) - IL_0017: ldc.i4.0 - IL_0018: ceq - IL_001a: stloc.1 - IL_001b: ldloc.1 - IL_001c: brtrue.s IL_0093 - - IL_001e: nop - IL_001f: ldc.i4.0 - IL_0020: stloc.0 - IL_0021: br.s IL_0078 - - IL_0023: nop - IL_0024: ldstr "Loop Body" - IL_0029: call void [mscorlib]System.Console::WriteLine(string) - IL_002e: nop - IL_002f: ldarg.0 - IL_0030: ldstr "test" - IL_0035: call instance bool Loops::Condition(string) - IL_003a: ldc.i4.0 - IL_003b: ceq - IL_003d: stloc.1 - IL_003e: ldloc.1 - IL_003f: brtrue.s IL_0068 - - IL_0041: nop - IL_0042: ldarg.0 - IL_0043: ldstr "continue" - IL_0048: call instance bool Loops::Condition(string) - IL_004d: ldc.i4.0 - IL_004e: ceq - IL_0050: stloc.1 - IL_0051: ldloc.1 - IL_0052: brtrue.s IL_0056 - - IL_0054: br.s IL_0074 - - IL_0056: ldarg.0 - IL_0057: ldstr "break" - IL_005c: call instance bool Loops::Condition(string) - IL_0061: stloc.1 - IL_0062: ldloc.1 - IL_0063: brtrue.s IL_0067 - - IL_0065: br.s IL_0087 - - IL_0067: nop - IL_0068: ldstr "End of loop body" - IL_006d: call void [mscorlib]System.Console::WriteLine(string) - IL_0072: nop - IL_0073: nop - IL_0074: ldloc.0 - IL_0075: ldc.i4.1 - IL_0076: add - IL_0077: stloc.0 - IL_0078: ldarg.0 - IL_0079: ldstr "for" - IL_007e: call instance bool Loops::Condition(string) - IL_0083: stloc.1 - IL_0084: ldloc.1 - IL_0085: brtrue.s IL_0023 - - IL_0087: ldstr "After loop" - IL_008c: call void [mscorlib]System.Console::WriteLine(string) - IL_0091: nop - IL_0092: nop - IL_0093: ldstr "End of method" - IL_0098: call void [mscorlib]System.Console::WriteLine(string) - IL_009d: nop - IL_009e: ret - } // end of method Loops::ForLoop - - .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 Loops::.ctor - -} // end of class Loops - - -// ============================================================= - -// *********** DISASSEMBLY COMPLETE *********************** -// WARNING: Created Win32 resource file ../../Tests/TestCases/Pretty\Loops.res diff --git a/ICSharpCode.Decompiler/Tests/TestCases/Pretty/Loops.opt.il b/ICSharpCode.Decompiler/Tests/TestCases/Pretty/Loops.opt.il deleted file mode 100644 index d894ae542..000000000 --- a/ICSharpCode.Decompiler/Tests/TestCases/Pretty/Loops.opt.il +++ /dev/null @@ -1,539 +0,0 @@ - -// 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 sscw5l23 -{ - .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 sscw5l23.dll -// MVID: {991357DB-B65F-4BB1-8C96-4C4C12DBD249} -.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: 0x01540000 - - -// =============== CLASS MEMBERS DECLARATION =================== - -.class public auto ansi beforefieldinit Loops - extends [mscorlib]System.Object -{ - .method public hidebysig instance void - ForEach(class [mscorlib]System.Collections.Generic.IEnumerable`1 enumerable) cil managed - { - // Code size 44 (0x2c) - .maxstack 1 - .locals init (string V_0, - class [mscorlib]System.Collections.Generic.IEnumerator`1 V_1) - IL_0000: ldarg.1 - IL_0001: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerator`1 class [mscorlib]System.Collections.Generic.IEnumerable`1::GetEnumerator() - IL_0006: stloc.1 - .try - { - IL_0007: br.s IL_0017 - - IL_0009: ldloc.1 - IL_000a: callvirt instance !0 class [mscorlib]System.Collections.Generic.IEnumerator`1::get_Current() - IL_000f: stloc.0 - IL_0010: ldloc.0 - IL_0011: callvirt instance string [mscorlib]System.String::ToLower() - IL_0016: pop - IL_0017: ldloc.1 - IL_0018: callvirt instance bool [mscorlib]System.Collections.IEnumerator::MoveNext() - IL_001d: brtrue.s IL_0009 - - IL_001f: leave.s IL_002b - - } // end .try - finally - { - IL_0021: ldloc.1 - IL_0022: brfalse.s IL_002a - - IL_0024: ldloc.1 - IL_0025: callvirt instance void [mscorlib]System.IDisposable::Dispose() - IL_002a: endfinally - } // end handler - IL_002b: ret - } // end of method Loops::ForEach - - .method public hidebysig instance void - ForEachOverList(class [mscorlib]System.Collections.Generic.List`1 list) cil managed - { - // Code size 50 (0x32) - .maxstack 1 - .locals init (string V_0, - valuetype [mscorlib]System.Collections.Generic.List`1/Enumerator V_1) - IL_0000: ldarg.1 - IL_0001: callvirt instance valuetype [mscorlib]System.Collections.Generic.List`1/Enumerator class [mscorlib]System.Collections.Generic.List`1::GetEnumerator() - IL_0006: stloc.1 - .try - { - IL_0007: br.s IL_0018 - - IL_0009: ldloca.s V_1 - IL_000b: call instance !0 valuetype [mscorlib]System.Collections.Generic.List`1/Enumerator::get_Current() - IL_0010: stloc.0 - IL_0011: ldloc.0 - IL_0012: callvirt instance string [mscorlib]System.String::ToLower() - IL_0017: pop - IL_0018: ldloca.s V_1 - IL_001a: call instance bool valuetype [mscorlib]System.Collections.Generic.List`1/Enumerator::MoveNext() - IL_001f: brtrue.s IL_0009 - - IL_0021: leave.s IL_0031 - - } // end .try - finally - { - IL_0023: ldloca.s V_1 - IL_0025: constrained. valuetype [mscorlib]System.Collections.Generic.List`1/Enumerator - IL_002b: callvirt instance void [mscorlib]System.IDisposable::Dispose() - IL_0030: endfinally - } // end handler - IL_0031: ret - } // end of method Loops::ForEachOverList - - .method public hidebysig instance void - ForEachOverNonGenericEnumerable(class [mscorlib]System.Collections.IEnumerable enumerable) cil managed - { - // Code size 51 (0x33) - .maxstack 1 - .locals init (object V_0, - class [mscorlib]System.Collections.IEnumerator V_1, - class [mscorlib]System.IDisposable V_2) - IL_0000: ldarg.1 - IL_0001: callvirt instance class [mscorlib]System.Collections.IEnumerator [mscorlib]System.Collections.IEnumerable::GetEnumerator() - IL_0006: stloc.1 - .try - { - IL_0007: br.s IL_0017 - - IL_0009: ldloc.1 - IL_000a: callvirt instance object [mscorlib]System.Collections.IEnumerator::get_Current() - IL_000f: stloc.0 - IL_0010: ldloc.0 - IL_0011: callvirt instance string [mscorlib]System.Object::ToString() - IL_0016: pop - IL_0017: ldloc.1 - IL_0018: callvirt instance bool [mscorlib]System.Collections.IEnumerator::MoveNext() - IL_001d: brtrue.s IL_0009 - - IL_001f: leave.s IL_0032 - - } // end .try - finally - { - IL_0021: ldloc.1 - IL_0022: isinst [mscorlib]System.IDisposable - IL_0027: stloc.2 - IL_0028: ldloc.2 - IL_0029: brfalse.s IL_0031 - - IL_002b: ldloc.2 - IL_002c: callvirt instance void [mscorlib]System.IDisposable::Dispose() - IL_0031: endfinally - } // end handler - IL_0032: ret - } // end of method Loops::ForEachOverNonGenericEnumerable - - .method public hidebysig instance void - ForEachOverNonGenericEnumerableWithAutomaticCast(class [mscorlib]System.Collections.IEnumerable enumerable) cil managed - { - // Code size 57 (0x39) - .maxstack 1 - .locals init (int32 V_0, - class [mscorlib]System.Collections.IEnumerator V_1, - class [mscorlib]System.IDisposable V_2) - IL_0000: ldarg.1 - IL_0001: callvirt instance class [mscorlib]System.Collections.IEnumerator [mscorlib]System.Collections.IEnumerable::GetEnumerator() - IL_0006: stloc.1 - .try - { - IL_0007: br.s IL_001d - - IL_0009: ldloc.1 - IL_000a: callvirt instance object [mscorlib]System.Collections.IEnumerator::get_Current() - IL_000f: unbox.any [mscorlib]System.Int32 - IL_0014: stloc.0 - IL_0015: ldloca.s V_0 - IL_0017: call instance string [mscorlib]System.Int32::ToString() - IL_001c: pop - IL_001d: ldloc.1 - IL_001e: callvirt instance bool [mscorlib]System.Collections.IEnumerator::MoveNext() - IL_0023: brtrue.s IL_0009 - - IL_0025: leave.s IL_0038 - - } // end .try - finally - { - IL_0027: ldloc.1 - IL_0028: isinst [mscorlib]System.IDisposable - IL_002d: stloc.2 - IL_002e: ldloc.2 - IL_002f: brfalse.s IL_0037 - - IL_0031: ldloc.2 - IL_0032: callvirt instance void [mscorlib]System.IDisposable::Dispose() - IL_0037: endfinally - } // end handler - IL_0038: ret - } // end of method Loops::ForEachOverNonGenericEnumerableWithAutomaticCast - - .method public hidebysig instance void - ForOverArray(string[] 'array') cil managed - { - // Code size 24 (0x18) - .maxstack 2 - .locals init (int32 V_0) - IL_0000: ldc.i4.0 - IL_0001: stloc.0 - IL_0002: br.s IL_0011 - - IL_0004: ldarg.1 - IL_0005: ldloc.0 - IL_0006: ldelem.ref - IL_0007: callvirt instance string [mscorlib]System.String::ToLower() - IL_000c: pop - IL_000d: ldloc.0 - IL_000e: ldc.i4.1 - IL_000f: add - IL_0010: stloc.0 - IL_0011: ldloc.0 - IL_0012: ldarg.1 - IL_0013: ldlen - IL_0014: conv.i4 - IL_0015: blt.s IL_0004 - - IL_0017: ret - } // end of method Loops::ForOverArray - - .method public hidebysig instance void - NestedLoops() cil managed - { - // Code size 53 (0x35) - .maxstack 2 - .locals init (int32 V_0, - int32 V_1) - IL_0000: ldc.i4.0 - IL_0001: stloc.0 - IL_0002: br.s IL_002f - - IL_0004: ldloc.0 - IL_0005: ldc.i4.2 - IL_0006: rem - IL_0007: brtrue.s IL_0021 - - IL_0009: ldc.i4.0 - IL_000a: stloc.1 - IL_000b: br.s IL_001b - - IL_000d: ldstr "Y" - IL_0012: call void [mscorlib]System.Console::WriteLine(string) - IL_0017: ldloc.1 - IL_0018: ldc.i4.1 - IL_0019: add - IL_001a: stloc.1 - IL_001b: ldloc.1 - IL_001c: ldc.i4.5 - IL_001d: blt.s IL_000d - - IL_001f: br.s IL_002b - - IL_0021: ldstr "X" - IL_0026: call void [mscorlib]System.Console::WriteLine(string) - IL_002b: ldloc.0 - IL_002c: ldc.i4.1 - IL_002d: add - IL_002e: stloc.0 - IL_002f: ldloc.0 - IL_0030: ldc.i4.s 10 - IL_0032: blt.s IL_0004 - - IL_0034: ret - } // end of method Loops::NestedLoops - - .method public hidebysig instance int32 - MultipleExits() cil managed - { - // Code size 42 (0x2a) - .maxstack 2 - .locals init (int32 V_0) - IL_0000: ldc.i4.0 - IL_0001: stloc.0 - IL_0002: ldloc.0 - IL_0003: ldc.i4.4 - IL_0004: rem - IL_0005: brtrue.s IL_0009 - - IL_0007: ldc.i4.4 - IL_0008: ret - - IL_0009: ldloc.0 - IL_000a: ldc.i4.7 - IL_000b: rem - IL_000c: brfalse.s IL_0022 - - IL_000e: ldloc.0 - IL_000f: ldc.i4.s 9 - IL_0011: rem - IL_0012: brtrue.s IL_0016 - - IL_0014: ldc.i4.5 - IL_0015: ret - - IL_0016: ldloc.0 - IL_0017: ldc.i4.s 11 - IL_0019: rem - IL_001a: brfalse.s IL_0022 - - IL_001c: ldloc.0 - IL_001d: ldc.i4.1 - IL_001e: add - IL_001f: stloc.0 - IL_0020: br.s IL_0002 - - IL_0022: ldc.i4 0x80000000 - IL_0027: stloc.0 - IL_0028: ldloc.0 - IL_0029: ret - } // end of method Loops::MultipleExits - - .method public hidebysig instance int32 - InterestingLoop() cil managed - { - // Code size 62 (0x3e) - .maxstack 2 - .locals init (int32 V_0) - IL_0000: ldc.i4.0 - IL_0001: stloc.0 - IL_0002: ldloc.0 - IL_0003: ldc.i4.s 11 - IL_0005: rem - IL_0006: brtrue.s IL_003c - - IL_0008: ldloc.0 - IL_0009: ldc.i4.4 - IL_000a: rem - IL_000b: brtrue.s IL_0030 - - IL_000d: ldloc.0 - IL_000e: ldc.i4.7 - IL_000f: rem - IL_0010: brtrue.s IL_0024 - - IL_0012: ldloc.0 - IL_0013: ldc.i4.s 11 - IL_0015: rem - IL_0016: brfalse.s IL_0008 - - IL_0018: ldstr "7" - IL_001d: call void [mscorlib]System.Console::WriteLine(string) - IL_0022: br.s IL_0036 - - IL_0024: ldstr "!7" - IL_0029: call void [mscorlib]System.Console::WriteLine(string) - IL_002e: br.s IL_0036 - - IL_0030: ldloc.0 - IL_0031: ldc.i4.1 - IL_0032: add - IL_0033: stloc.0 - IL_0034: br.s IL_0008 - - IL_0036: ldc.i4 0x80000000 - IL_003b: stloc.0 - IL_003c: ldloc.0 - IL_003d: ret - } // end of method Loops::InterestingLoop - - .method private hidebysig instance bool - Condition(string arg) cil managed - { - // Code size 18 (0x12) - .maxstack 8 - IL_0000: ldstr "Condition: " - IL_0005: ldarg.1 - IL_0006: call string [mscorlib]System.String::Concat(string, - string) - IL_000b: call void [mscorlib]System.Console::WriteLine(string) - IL_0010: ldc.i4.0 - IL_0011: ret - } // end of method Loops::Condition - - .method public hidebysig instance void - WhileLoop() cil managed - { - // Code size 118 (0x76) - .maxstack 2 - IL_0000: ldstr "Initial" - IL_0005: call void [mscorlib]System.Console::WriteLine(string) - IL_000a: ldarg.0 - IL_000b: ldstr "if" - IL_0010: call instance bool Loops::Condition(string) - IL_0015: brfalse.s IL_006b - - IL_0017: br.s IL_0054 - - IL_0019: ldstr "Loop Body" - IL_001e: call void [mscorlib]System.Console::WriteLine(string) - IL_0023: ldarg.0 - IL_0024: ldstr "test" - IL_0029: call instance bool Loops::Condition(string) - IL_002e: brfalse.s IL_004a - - IL_0030: ldarg.0 - IL_0031: ldstr "continue" - IL_0036: call instance bool Loops::Condition(string) - IL_003b: brtrue.s IL_0054 - - IL_003d: ldarg.0 - IL_003e: ldstr "break" - IL_0043: call instance bool Loops::Condition(string) - IL_0048: brfalse.s IL_0061 - - IL_004a: ldstr "End of loop body" - IL_004f: call void [mscorlib]System.Console::WriteLine(string) - IL_0054: ldarg.0 - IL_0055: ldstr "while" - IL_005a: call instance bool Loops::Condition(string) - IL_005f: brtrue.s IL_0019 - - IL_0061: ldstr "After loop" - IL_0066: call void [mscorlib]System.Console::WriteLine(string) - IL_006b: ldstr "End of method" - IL_0070: call void [mscorlib]System.Console::WriteLine(string) - IL_0075: ret - } // end of method Loops::WhileLoop - - .method public hidebysig instance void - DoWhileLoop() cil managed - { - // Code size 116 (0x74) - .maxstack 2 - IL_0000: ldstr "Initial" - IL_0005: call void [mscorlib]System.Console::WriteLine(string) - IL_000a: ldarg.0 - IL_000b: ldstr "if" - IL_0010: call instance bool Loops::Condition(string) - IL_0015: brfalse.s IL_0069 - - IL_0017: ldstr "Loop Body" - IL_001c: call void [mscorlib]System.Console::WriteLine(string) - IL_0021: ldarg.0 - IL_0022: ldstr "test" - IL_0027: call instance bool Loops::Condition(string) - IL_002c: brfalse.s IL_0048 - - IL_002e: ldarg.0 - IL_002f: ldstr "continue" - IL_0034: call instance bool Loops::Condition(string) - IL_0039: brtrue.s IL_0052 - - IL_003b: ldarg.0 - IL_003c: ldstr "break" - IL_0041: call instance bool Loops::Condition(string) - IL_0046: brfalse.s IL_005f - - IL_0048: ldstr "End of loop body" - IL_004d: call void [mscorlib]System.Console::WriteLine(string) - IL_0052: ldarg.0 - IL_0053: ldstr "while" - IL_0058: call instance bool Loops::Condition(string) - IL_005d: brtrue.s IL_0017 - - IL_005f: ldstr "After loop" - IL_0064: call void [mscorlib]System.Console::WriteLine(string) - IL_0069: ldstr "End of method" - IL_006e: call void [mscorlib]System.Console::WriteLine(string) - IL_0073: ret - } // end of method Loops::DoWhileLoop - - .method public hidebysig instance void - ForLoop() cil managed - { - // Code size 124 (0x7c) - .maxstack 2 - .locals init (int32 V_0) - IL_0000: ldstr "Initial" - IL_0005: call void [mscorlib]System.Console::WriteLine(string) - IL_000a: ldarg.0 - IL_000b: ldstr "if" - IL_0010: call instance bool Loops::Condition(string) - IL_0015: brfalse.s IL_0071 - - IL_0017: ldc.i4.0 - IL_0018: stloc.0 - IL_0019: br.s IL_005a - - IL_001b: ldstr "Loop Body" - IL_0020: call void [mscorlib]System.Console::WriteLine(string) - IL_0025: ldarg.0 - IL_0026: ldstr "test" - IL_002b: call instance bool Loops::Condition(string) - IL_0030: brfalse.s IL_004c - - IL_0032: ldarg.0 - IL_0033: ldstr "continue" - IL_0038: call instance bool Loops::Condition(string) - IL_003d: brtrue.s IL_0056 - - IL_003f: ldarg.0 - IL_0040: ldstr "break" - IL_0045: call instance bool Loops::Condition(string) - IL_004a: brfalse.s IL_0067 - - IL_004c: ldstr "End of loop body" - IL_0051: call void [mscorlib]System.Console::WriteLine(string) - IL_0056: ldloc.0 - IL_0057: ldc.i4.1 - IL_0058: add - IL_0059: stloc.0 - IL_005a: ldarg.0 - IL_005b: ldstr "for" - IL_0060: call instance bool Loops::Condition(string) - IL_0065: brtrue.s IL_001b - - IL_0067: ldstr "After loop" - IL_006c: call void [mscorlib]System.Console::WriteLine(string) - IL_0071: ldstr "End of method" - IL_0076: call void [mscorlib]System.Console::WriteLine(string) - IL_007b: ret - } // end of method Loops::ForLoop - - .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 Loops::.ctor - -} // end of class Loops - - -// ============================================================= - -// *********** DISASSEMBLY COMPLETE *********************** -// WARNING: Created Win32 resource file ../../Tests/TestCases/Pretty\Loops.opt.res diff --git a/ICSharpCode.Decompiler/Tests/TestCases/Pretty/Loops.opt.roslyn.il b/ICSharpCode.Decompiler/Tests/TestCases/Pretty/Loops.opt.roslyn.il deleted file mode 100644 index fb96bb915..000000000 --- a/ICSharpCode.Decompiler/Tests/TestCases/Pretty/Loops.opt.roslyn.il +++ /dev/null @@ -1,533 +0,0 @@ - -// 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 Loops -{ - .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 Loops.dll -// MVID: {1E648DB1-AE71-458C-A97F-5EE152713902} -.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: 0x00D90000 - - -// =============== CLASS MEMBERS DECLARATION =================== - -.class public auto ansi beforefieldinit Loops - extends [mscorlib]System.Object -{ - .method public hidebysig instance void - ForEach(class [mscorlib]System.Collections.Generic.IEnumerable`1 enumerable) cil managed - { - // Code size 42 (0x2a) - .maxstack 1 - .locals init (class [mscorlib]System.Collections.Generic.IEnumerator`1 V_0) - IL_0000: ldarg.1 - IL_0001: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerator`1 class [mscorlib]System.Collections.Generic.IEnumerable`1::GetEnumerator() - IL_0006: stloc.0 - .try - { - IL_0007: br.s IL_0015 - - IL_0009: ldloc.0 - IL_000a: callvirt instance !0 class [mscorlib]System.Collections.Generic.IEnumerator`1::get_Current() - IL_000f: callvirt instance string [mscorlib]System.String::ToLower() - IL_0014: pop - IL_0015: ldloc.0 - IL_0016: callvirt instance bool [mscorlib]System.Collections.IEnumerator::MoveNext() - IL_001b: brtrue.s IL_0009 - - IL_001d: leave.s IL_0029 - - } // end .try - finally - { - IL_001f: ldloc.0 - IL_0020: brfalse.s IL_0028 - - IL_0022: ldloc.0 - IL_0023: callvirt instance void [mscorlib]System.IDisposable::Dispose() - IL_0028: endfinally - } // end handler - IL_0029: ret - } // end of method Loops::ForEach - - .method public hidebysig instance void - ForEachOverList(class [mscorlib]System.Collections.Generic.List`1 list) cil managed - { - // Code size 48 (0x30) - .maxstack 1 - .locals init (valuetype [mscorlib]System.Collections.Generic.List`1/Enumerator V_0) - IL_0000: ldarg.1 - IL_0001: callvirt instance valuetype [mscorlib]System.Collections.Generic.List`1/Enumerator class [mscorlib]System.Collections.Generic.List`1::GetEnumerator() - IL_0006: stloc.0 - .try - { - IL_0007: br.s IL_0016 - - IL_0009: ldloca.s V_0 - IL_000b: call instance !0 valuetype [mscorlib]System.Collections.Generic.List`1/Enumerator::get_Current() - IL_0010: callvirt instance string [mscorlib]System.String::ToLower() - IL_0015: pop - IL_0016: ldloca.s V_0 - IL_0018: call instance bool valuetype [mscorlib]System.Collections.Generic.List`1/Enumerator::MoveNext() - IL_001d: brtrue.s IL_0009 - - IL_001f: leave.s IL_002f - - } // end .try - finally - { - IL_0021: ldloca.s V_0 - IL_0023: constrained. valuetype [mscorlib]System.Collections.Generic.List`1/Enumerator - IL_0029: callvirt instance void [mscorlib]System.IDisposable::Dispose() - IL_002e: endfinally - } // end handler - IL_002f: ret - } // end of method Loops::ForEachOverList - - .method public hidebysig instance void - ForEachOverNonGenericEnumerable(class [mscorlib]System.Collections.IEnumerable enumerable) cil managed - { - // Code size 49 (0x31) - .maxstack 1 - .locals init (class [mscorlib]System.Collections.IEnumerator V_0, - class [mscorlib]System.IDisposable V_1) - IL_0000: ldarg.1 - IL_0001: callvirt instance class [mscorlib]System.Collections.IEnumerator [mscorlib]System.Collections.IEnumerable::GetEnumerator() - IL_0006: stloc.0 - .try - { - IL_0007: br.s IL_0015 - - IL_0009: ldloc.0 - IL_000a: callvirt instance object [mscorlib]System.Collections.IEnumerator::get_Current() - IL_000f: callvirt instance string [mscorlib]System.Object::ToString() - IL_0014: pop - IL_0015: ldloc.0 - IL_0016: callvirt instance bool [mscorlib]System.Collections.IEnumerator::MoveNext() - IL_001b: brtrue.s IL_0009 - - IL_001d: leave.s IL_0030 - - } // end .try - finally - { - IL_001f: ldloc.0 - IL_0020: isinst [mscorlib]System.IDisposable - IL_0025: stloc.1 - IL_0026: ldloc.1 - IL_0027: brfalse.s IL_002f - - IL_0029: ldloc.1 - IL_002a: callvirt instance void [mscorlib]System.IDisposable::Dispose() - IL_002f: endfinally - } // end handler - IL_0030: ret - } // end of method Loops::ForEachOverNonGenericEnumerable - - .method public hidebysig instance void - ForEachOverNonGenericEnumerableWithAutomaticCast(class [mscorlib]System.Collections.IEnumerable enumerable) cil managed - { - // Code size 57 (0x39) - .maxstack 1 - .locals init (class [mscorlib]System.Collections.IEnumerator V_0, - int32 V_1, - class [mscorlib]System.IDisposable V_2) - IL_0000: ldarg.1 - IL_0001: callvirt instance class [mscorlib]System.Collections.IEnumerator [mscorlib]System.Collections.IEnumerable::GetEnumerator() - IL_0006: stloc.0 - .try - { - IL_0007: br.s IL_001d - - IL_0009: ldloc.0 - IL_000a: callvirt instance object [mscorlib]System.Collections.IEnumerator::get_Current() - IL_000f: unbox.any [mscorlib]System.Int32 - IL_0014: stloc.1 - IL_0015: ldloca.s V_1 - IL_0017: call instance string [mscorlib]System.Int32::ToString() - IL_001c: pop - IL_001d: ldloc.0 - IL_001e: callvirt instance bool [mscorlib]System.Collections.IEnumerator::MoveNext() - IL_0023: brtrue.s IL_0009 - - IL_0025: leave.s IL_0038 - - } // end .try - finally - { - IL_0027: ldloc.0 - IL_0028: isinst [mscorlib]System.IDisposable - IL_002d: stloc.2 - IL_002e: ldloc.2 - IL_002f: brfalse.s IL_0037 - - IL_0031: ldloc.2 - IL_0032: callvirt instance void [mscorlib]System.IDisposable::Dispose() - IL_0037: endfinally - } // end handler - IL_0038: ret - } // end of method Loops::ForEachOverNonGenericEnumerableWithAutomaticCast - - .method public hidebysig instance void - ForOverArray(string[] 'array') cil managed - { - // Code size 24 (0x18) - .maxstack 2 - .locals init (int32 V_0) - IL_0000: ldc.i4.0 - IL_0001: stloc.0 - IL_0002: br.s IL_0011 - - IL_0004: ldarg.1 - IL_0005: ldloc.0 - IL_0006: ldelem.ref - IL_0007: callvirt instance string [mscorlib]System.String::ToLower() - IL_000c: pop - IL_000d: ldloc.0 - IL_000e: ldc.i4.1 - IL_000f: add - IL_0010: stloc.0 - IL_0011: ldloc.0 - IL_0012: ldarg.1 - IL_0013: ldlen - IL_0014: conv.i4 - IL_0015: blt.s IL_0004 - - IL_0017: ret - } // end of method Loops::ForOverArray - - .method public hidebysig instance void - NestedLoops() cil managed - { - // Code size 53 (0x35) - .maxstack 2 - .locals init (int32 V_0, - int32 V_1) - IL_0000: ldc.i4.0 - IL_0001: stloc.0 - IL_0002: br.s IL_002f - - IL_0004: ldloc.0 - IL_0005: ldc.i4.2 - IL_0006: rem - IL_0007: brtrue.s IL_0021 - - IL_0009: ldc.i4.0 - IL_000a: stloc.1 - IL_000b: br.s IL_001b - - IL_000d: ldstr "Y" - IL_0012: call void [mscorlib]System.Console::WriteLine(string) - IL_0017: ldloc.1 - IL_0018: ldc.i4.1 - IL_0019: add - IL_001a: stloc.1 - IL_001b: ldloc.1 - IL_001c: ldc.i4.5 - IL_001d: blt.s IL_000d - - IL_001f: br.s IL_002b - - IL_0021: ldstr "X" - IL_0026: call void [mscorlib]System.Console::WriteLine(string) - IL_002b: ldloc.0 - IL_002c: ldc.i4.1 - IL_002d: add - IL_002e: stloc.0 - IL_002f: ldloc.0 - IL_0030: ldc.i4.s 10 - IL_0032: blt.s IL_0004 - - IL_0034: ret - } // end of method Loops::NestedLoops - - .method public hidebysig instance int32 - MultipleExits() cil managed - { - // Code size 42 (0x2a) - .maxstack 2 - .locals init (int32 V_0) - IL_0000: ldc.i4.0 - IL_0001: stloc.0 - IL_0002: ldloc.0 - IL_0003: ldc.i4.4 - IL_0004: rem - IL_0005: brtrue.s IL_0009 - - IL_0007: ldc.i4.4 - IL_0008: ret - - IL_0009: ldloc.0 - IL_000a: ldc.i4.7 - IL_000b: rem - IL_000c: brfalse.s IL_0022 - - IL_000e: ldloc.0 - IL_000f: ldc.i4.s 9 - IL_0011: rem - IL_0012: brtrue.s IL_0016 - - IL_0014: ldc.i4.5 - IL_0015: ret - - IL_0016: ldloc.0 - IL_0017: ldc.i4.s 11 - IL_0019: rem - IL_001a: brfalse.s IL_0022 - - IL_001c: ldloc.0 - IL_001d: ldc.i4.1 - IL_001e: add - IL_001f: stloc.0 - IL_0020: br.s IL_0002 - - IL_0022: ldc.i4 0x80000000 - IL_0027: stloc.0 - IL_0028: ldloc.0 - IL_0029: ret - } // end of method Loops::MultipleExits - - .method public hidebysig instance int32 - InterestingLoop() cil managed - { - // Code size 62 (0x3e) - .maxstack 2 - .locals init (int32 V_0) - IL_0000: ldc.i4.0 - IL_0001: stloc.0 - IL_0002: ldloc.0 - IL_0003: ldc.i4.s 11 - IL_0005: rem - IL_0006: brtrue.s IL_003c - - IL_0008: ldloc.0 - IL_0009: ldc.i4.4 - IL_000a: rem - IL_000b: brtrue.s IL_0030 - - IL_000d: ldloc.0 - IL_000e: ldc.i4.7 - IL_000f: rem - IL_0010: brtrue.s IL_0024 - - IL_0012: ldloc.0 - IL_0013: ldc.i4.s 11 - IL_0015: rem - IL_0016: brfalse.s IL_0008 - - IL_0018: ldstr "7" - IL_001d: call void [mscorlib]System.Console::WriteLine(string) - IL_0022: br.s IL_0036 - - IL_0024: ldstr "!7" - IL_0029: call void [mscorlib]System.Console::WriteLine(string) - IL_002e: br.s IL_0036 - - IL_0030: ldloc.0 - IL_0031: ldc.i4.1 - IL_0032: add - IL_0033: stloc.0 - IL_0034: br.s IL_0008 - - IL_0036: ldc.i4 0x80000000 - IL_003b: stloc.0 - IL_003c: ldloc.0 - IL_003d: ret - } // end of method Loops::InterestingLoop - - .method private hidebysig instance bool - Condition(string arg) cil managed - { - // Code size 18 (0x12) - .maxstack 8 - IL_0000: ldstr "Condition: " - IL_0005: ldarg.1 - IL_0006: call string [mscorlib]System.String::Concat(string, - string) - IL_000b: call void [mscorlib]System.Console::WriteLine(string) - IL_0010: ldc.i4.0 - IL_0011: ret - } // end of method Loops::Condition - - .method public hidebysig instance void - WhileLoop() cil managed - { - // Code size 118 (0x76) - .maxstack 2 - IL_0000: ldstr "Initial" - IL_0005: call void [mscorlib]System.Console::WriteLine(string) - IL_000a: ldarg.0 - IL_000b: ldstr "if" - IL_0010: call instance bool Loops::Condition(string) - IL_0015: brfalse.s IL_006b - - IL_0017: br.s IL_0054 - - IL_0019: ldstr "Loop Body" - IL_001e: call void [mscorlib]System.Console::WriteLine(string) - IL_0023: ldarg.0 - IL_0024: ldstr "test" - IL_0029: call instance bool Loops::Condition(string) - IL_002e: brfalse.s IL_004a - - IL_0030: ldarg.0 - IL_0031: ldstr "continue" - IL_0036: call instance bool Loops::Condition(string) - IL_003b: brtrue.s IL_0054 - - IL_003d: ldarg.0 - IL_003e: ldstr "break" - IL_0043: call instance bool Loops::Condition(string) - IL_0048: brfalse.s IL_0061 - - IL_004a: ldstr "End of loop body" - IL_004f: call void [mscorlib]System.Console::WriteLine(string) - IL_0054: ldarg.0 - IL_0055: ldstr "while" - IL_005a: call instance bool Loops::Condition(string) - IL_005f: brtrue.s IL_0019 - - IL_0061: ldstr "After loop" - IL_0066: call void [mscorlib]System.Console::WriteLine(string) - IL_006b: ldstr "End of method" - IL_0070: call void [mscorlib]System.Console::WriteLine(string) - IL_0075: ret - } // end of method Loops::WhileLoop - - .method public hidebysig instance void - DoWhileLoop() cil managed - { - // Code size 116 (0x74) - .maxstack 2 - IL_0000: ldstr "Initial" - IL_0005: call void [mscorlib]System.Console::WriteLine(string) - IL_000a: ldarg.0 - IL_000b: ldstr "if" - IL_0010: call instance bool Loops::Condition(string) - IL_0015: brfalse.s IL_0069 - - IL_0017: ldstr "Loop Body" - IL_001c: call void [mscorlib]System.Console::WriteLine(string) - IL_0021: ldarg.0 - IL_0022: ldstr "test" - IL_0027: call instance bool Loops::Condition(string) - IL_002c: brfalse.s IL_0048 - - IL_002e: ldarg.0 - IL_002f: ldstr "continue" - IL_0034: call instance bool Loops::Condition(string) - IL_0039: brtrue.s IL_0052 - - IL_003b: ldarg.0 - IL_003c: ldstr "break" - IL_0041: call instance bool Loops::Condition(string) - IL_0046: brfalse.s IL_005f - - IL_0048: ldstr "End of loop body" - IL_004d: call void [mscorlib]System.Console::WriteLine(string) - IL_0052: ldarg.0 - IL_0053: ldstr "while" - IL_0058: call instance bool Loops::Condition(string) - IL_005d: brtrue.s IL_0017 - - IL_005f: ldstr "After loop" - IL_0064: call void [mscorlib]System.Console::WriteLine(string) - IL_0069: ldstr "End of method" - IL_006e: call void [mscorlib]System.Console::WriteLine(string) - IL_0073: ret - } // end of method Loops::DoWhileLoop - - .method public hidebysig instance void - ForLoop() cil managed - { - // Code size 124 (0x7c) - .maxstack 2 - .locals init (int32 V_0) - IL_0000: ldstr "Initial" - IL_0005: call void [mscorlib]System.Console::WriteLine(string) - IL_000a: ldarg.0 - IL_000b: ldstr "if" - IL_0010: call instance bool Loops::Condition(string) - IL_0015: brfalse.s IL_0071 - - IL_0017: ldc.i4.0 - IL_0018: stloc.0 - IL_0019: br.s IL_005a - - IL_001b: ldstr "Loop Body" - IL_0020: call void [mscorlib]System.Console::WriteLine(string) - IL_0025: ldarg.0 - IL_0026: ldstr "test" - IL_002b: call instance bool Loops::Condition(string) - IL_0030: brfalse.s IL_004c - - IL_0032: ldarg.0 - IL_0033: ldstr "continue" - IL_0038: call instance bool Loops::Condition(string) - IL_003d: brtrue.s IL_0056 - - IL_003f: ldarg.0 - IL_0040: ldstr "break" - IL_0045: call instance bool Loops::Condition(string) - IL_004a: brfalse.s IL_0067 - - IL_004c: ldstr "End of loop body" - IL_0051: call void [mscorlib]System.Console::WriteLine(string) - IL_0056: ldloc.0 - IL_0057: ldc.i4.1 - IL_0058: add - IL_0059: stloc.0 - IL_005a: ldarg.0 - IL_005b: ldstr "for" - IL_0060: call instance bool Loops::Condition(string) - IL_0065: brtrue.s IL_001b - - IL_0067: ldstr "After loop" - IL_006c: call void [mscorlib]System.Console::WriteLine(string) - IL_0071: ldstr "End of method" - IL_0076: call void [mscorlib]System.Console::WriteLine(string) - IL_007b: ret - } // end of method Loops::ForLoop - - .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 Loops::.ctor - -} // end of class Loops - - -// ============================================================= - -// *********** DISASSEMBLY COMPLETE *********************** diff --git a/ICSharpCode.Decompiler/Tests/TestCases/Pretty/Loops.roslyn.il b/ICSharpCode.Decompiler/Tests/TestCases/Pretty/Loops.roslyn.il deleted file mode 100644 index 1345e8aa5..000000000 --- a/ICSharpCode.Decompiler/Tests/TestCases/Pretty/Loops.roslyn.il +++ /dev/null @@ -1,788 +0,0 @@ - -// 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 Loops -{ - .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 Loops.dll -// MVID: {69EBFE6B-B565-4A37-BEDC-C3B379045637} -.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: 0x03480000 - - -// =============== CLASS MEMBERS DECLARATION =================== - -.class public auto ansi beforefieldinit Loops - extends [mscorlib]System.Object -{ - .method public hidebysig instance void - ForEach(class [mscorlib]System.Collections.Generic.IEnumerable`1 enumerable) cil managed - { - // Code size 49 (0x31) - .maxstack 1 - .locals init (class [mscorlib]System.Collections.Generic.IEnumerator`1 V_0, - string V_1) - IL_0000: nop - IL_0001: nop - IL_0002: ldarg.1 - IL_0003: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerator`1 class [mscorlib]System.Collections.Generic.IEnumerable`1::GetEnumerator() - IL_0008: stloc.0 - .try - { - IL_0009: br.s IL_001b - - IL_000b: ldloc.0 - IL_000c: callvirt instance !0 class [mscorlib]System.Collections.Generic.IEnumerator`1::get_Current() - IL_0011: stloc.1 - IL_0012: nop - IL_0013: ldloc.1 - IL_0014: callvirt instance string [mscorlib]System.String::ToLower() - IL_0019: pop - IL_001a: nop - IL_001b: ldloc.0 - IL_001c: callvirt instance bool [mscorlib]System.Collections.IEnumerator::MoveNext() - IL_0021: brtrue.s IL_000b - - IL_0023: leave.s IL_0030 - - } // end .try - finally - { - IL_0025: ldloc.0 - IL_0026: brfalse.s IL_002f - - IL_0028: ldloc.0 - IL_0029: callvirt instance void [mscorlib]System.IDisposable::Dispose() - IL_002e: nop - IL_002f: endfinally - } // end handler - IL_0030: ret - } // end of method Loops::ForEach - - .method public hidebysig instance void - ForEachOverList(class [mscorlib]System.Collections.Generic.List`1 list) cil managed - { - // Code size 55 (0x37) - .maxstack 1 - .locals init (valuetype [mscorlib]System.Collections.Generic.List`1/Enumerator V_0, - string V_1) - IL_0000: nop - IL_0001: nop - IL_0002: ldarg.1 - IL_0003: callvirt instance valuetype [mscorlib]System.Collections.Generic.List`1/Enumerator class [mscorlib]System.Collections.Generic.List`1::GetEnumerator() - IL_0008: stloc.0 - .try - { - IL_0009: br.s IL_001c - - IL_000b: ldloca.s V_0 - IL_000d: call instance !0 valuetype [mscorlib]System.Collections.Generic.List`1/Enumerator::get_Current() - IL_0012: stloc.1 - IL_0013: nop - IL_0014: ldloc.1 - IL_0015: callvirt instance string [mscorlib]System.String::ToLower() - IL_001a: pop - IL_001b: nop - IL_001c: ldloca.s V_0 - IL_001e: call instance bool valuetype [mscorlib]System.Collections.Generic.List`1/Enumerator::MoveNext() - IL_0023: brtrue.s IL_000b - - IL_0025: leave.s IL_0036 - - } // end .try - finally - { - IL_0027: ldloca.s V_0 - IL_0029: constrained. valuetype [mscorlib]System.Collections.Generic.List`1/Enumerator - IL_002f: callvirt instance void [mscorlib]System.IDisposable::Dispose() - IL_0034: nop - IL_0035: endfinally - } // end handler - IL_0036: ret - } // end of method Loops::ForEachOverList - - .method public hidebysig instance void - ForEachOverNonGenericEnumerable(class [mscorlib]System.Collections.IEnumerable enumerable) cil managed - { - // Code size 56 (0x38) - .maxstack 1 - .locals init (class [mscorlib]System.Collections.IEnumerator V_0, - object V_1, - class [mscorlib]System.IDisposable V_2) - IL_0000: nop - IL_0001: nop - IL_0002: ldarg.1 - IL_0003: callvirt instance class [mscorlib]System.Collections.IEnumerator [mscorlib]System.Collections.IEnumerable::GetEnumerator() - IL_0008: stloc.0 - .try - { - IL_0009: br.s IL_001b - - IL_000b: ldloc.0 - IL_000c: callvirt instance object [mscorlib]System.Collections.IEnumerator::get_Current() - IL_0011: stloc.1 - IL_0012: nop - IL_0013: ldloc.1 - IL_0014: callvirt instance string [mscorlib]System.Object::ToString() - IL_0019: pop - IL_001a: nop - IL_001b: ldloc.0 - IL_001c: callvirt instance bool [mscorlib]System.Collections.IEnumerator::MoveNext() - IL_0021: brtrue.s IL_000b - - IL_0023: leave.s IL_0037 - - } // end .try - finally - { - IL_0025: ldloc.0 - IL_0026: isinst [mscorlib]System.IDisposable - IL_002b: stloc.2 - IL_002c: ldloc.2 - IL_002d: brfalse.s IL_0036 - - IL_002f: ldloc.2 - IL_0030: callvirt instance void [mscorlib]System.IDisposable::Dispose() - IL_0035: nop - IL_0036: endfinally - } // end handler - IL_0037: ret - } // end of method Loops::ForEachOverNonGenericEnumerable - - .method public hidebysig instance void - ForEachOverNonGenericEnumerableWithAutomaticCast(class [mscorlib]System.Collections.IEnumerable enumerable) cil managed - { - // Code size 62 (0x3e) - .maxstack 1 - .locals init (class [mscorlib]System.Collections.IEnumerator V_0, - int32 V_1, - class [mscorlib]System.IDisposable V_2) - IL_0000: nop - IL_0001: nop - IL_0002: ldarg.1 - IL_0003: callvirt instance class [mscorlib]System.Collections.IEnumerator [mscorlib]System.Collections.IEnumerable::GetEnumerator() - IL_0008: stloc.0 - .try - { - IL_0009: br.s IL_0021 - - IL_000b: ldloc.0 - IL_000c: callvirt instance object [mscorlib]System.Collections.IEnumerator::get_Current() - IL_0011: unbox.any [mscorlib]System.Int32 - IL_0016: stloc.1 - IL_0017: nop - IL_0018: ldloca.s V_1 - IL_001a: call instance string [mscorlib]System.Int32::ToString() - IL_001f: pop - IL_0020: nop - IL_0021: ldloc.0 - IL_0022: callvirt instance bool [mscorlib]System.Collections.IEnumerator::MoveNext() - IL_0027: brtrue.s IL_000b - - IL_0029: leave.s IL_003d - - } // end .try - finally - { - IL_002b: ldloc.0 - IL_002c: isinst [mscorlib]System.IDisposable - IL_0031: stloc.2 - IL_0032: ldloc.2 - IL_0033: brfalse.s IL_003c - - IL_0035: ldloc.2 - IL_0036: callvirt instance void [mscorlib]System.IDisposable::Dispose() - IL_003b: nop - IL_003c: endfinally - } // end handler - IL_003d: ret - } // end of method Loops::ForEachOverNonGenericEnumerableWithAutomaticCast - - .method public hidebysig instance void - ForOverArray(string[] 'array') cil managed - { - // Code size 31 (0x1f) - .maxstack 2 - .locals init (int32 V_0, - bool V_1) - IL_0000: nop - IL_0001: ldc.i4.0 - IL_0002: stloc.0 - IL_0003: br.s IL_0014 - - IL_0005: nop - IL_0006: ldarg.1 - IL_0007: ldloc.0 - IL_0008: ldelem.ref - IL_0009: callvirt instance string [mscorlib]System.String::ToLower() - IL_000e: pop - IL_000f: nop - IL_0010: ldloc.0 - IL_0011: ldc.i4.1 - IL_0012: add - IL_0013: stloc.0 - IL_0014: ldloc.0 - IL_0015: ldarg.1 - IL_0016: ldlen - IL_0017: conv.i4 - IL_0018: clt - IL_001a: stloc.1 - IL_001b: ldloc.1 - IL_001c: brtrue.s IL_0005 - - IL_001e: ret - } // end of method Loops::ForOverArray - - .method public hidebysig instance void - NestedLoops() cil managed - { - // Code size 79 (0x4f) - .maxstack 2 - .locals init (int32 V_0, - bool V_1, - int32 V_2, - bool V_3, - bool V_4) - IL_0000: nop - IL_0001: ldc.i4.0 - IL_0002: stloc.0 - IL_0003: br.s IL_0043 - - IL_0005: nop - IL_0006: ldloc.0 - IL_0007: ldc.i4.2 - IL_0008: rem - IL_0009: ldc.i4.0 - IL_000a: ceq - IL_000c: stloc.1 - IL_000d: ldloc.1 - IL_000e: brfalse.s IL_0031 - - IL_0010: nop - IL_0011: ldc.i4.0 - IL_0012: stloc.2 - IL_0013: br.s IL_0026 - - IL_0015: nop - IL_0016: ldstr "Y" - IL_001b: call void [mscorlib]System.Console::WriteLine(string) - IL_0020: nop - IL_0021: nop - IL_0022: ldloc.2 - IL_0023: ldc.i4.1 - IL_0024: add - IL_0025: stloc.2 - IL_0026: ldloc.2 - IL_0027: ldc.i4.5 - IL_0028: clt - IL_002a: stloc.3 - IL_002b: ldloc.3 - IL_002c: brtrue.s IL_0015 - - IL_002e: nop - IL_002f: br.s IL_003e - - IL_0031: nop - IL_0032: ldstr "X" - IL_0037: call void [mscorlib]System.Console::WriteLine(string) - IL_003c: nop - IL_003d: nop - IL_003e: nop - IL_003f: ldloc.0 - IL_0040: ldc.i4.1 - IL_0041: add - IL_0042: stloc.0 - IL_0043: ldloc.0 - IL_0044: ldc.i4.s 10 - IL_0046: clt - IL_0048: stloc.s V_4 - IL_004a: ldloc.s V_4 - IL_004c: brtrue.s IL_0005 - - IL_004e: ret - } // end of method Loops::NestedLoops - - .method public hidebysig instance int32 - MultipleExits() cil managed - { - // Code size 90 (0x5a) - .maxstack 2 - .locals init (int32 V_0, - bool V_1, - int32 V_2, - bool V_3, - bool V_4, - bool V_5, - bool V_6) - IL_0000: nop - IL_0001: ldc.i4.0 - IL_0002: stloc.0 - IL_0003: br.s IL_0049 - - IL_0005: nop - IL_0006: ldloc.0 - IL_0007: ldc.i4.4 - IL_0008: rem - IL_0009: ldc.i4.0 - IL_000a: ceq - IL_000c: stloc.1 - IL_000d: ldloc.1 - IL_000e: brfalse.s IL_0015 - - IL_0010: nop - IL_0011: ldc.i4.4 - IL_0012: stloc.2 - IL_0013: br.s IL_0058 - - IL_0015: ldloc.0 - IL_0016: ldc.i4.7 - IL_0017: rem - IL_0018: ldc.i4.0 - IL_0019: ceq - IL_001b: stloc.3 - IL_001c: ldloc.3 - IL_001d: brfalse.s IL_0022 - - IL_001f: nop - IL_0020: br.s IL_004e - - IL_0022: ldloc.0 - IL_0023: ldc.i4.s 9 - IL_0025: rem - IL_0026: ldc.i4.0 - IL_0027: ceq - IL_0029: stloc.s V_4 - IL_002b: ldloc.s V_4 - IL_002d: brfalse.s IL_0034 - - IL_002f: nop - IL_0030: ldc.i4.5 - IL_0031: stloc.2 - IL_0032: br.s IL_0058 - - IL_0034: ldloc.0 - IL_0035: ldc.i4.s 11 - IL_0037: rem - IL_0038: ldc.i4.0 - IL_0039: ceq - IL_003b: stloc.s V_5 - IL_003d: ldloc.s V_5 - IL_003f: brfalse.s IL_0044 - - IL_0041: nop - IL_0042: br.s IL_004e - - IL_0044: ldloc.0 - IL_0045: ldc.i4.1 - IL_0046: add - IL_0047: stloc.0 - IL_0048: nop - IL_0049: ldc.i4.1 - IL_004a: stloc.s V_6 - IL_004c: br.s IL_0005 - - IL_004e: ldc.i4 0x80000000 - IL_0053: stloc.0 - IL_0054: ldloc.0 - IL_0055: stloc.2 - IL_0056: br.s IL_0058 - - IL_0058: ldloc.2 - IL_0059: ret - } // end of method Loops::MultipleExits - - .method public hidebysig instance int32 - InterestingLoop() cil managed - { - // Code size 110 (0x6e) - .maxstack 2 - .locals init (int32 V_0, - bool V_1, - bool V_2, - bool V_3, - bool V_4, - bool V_5, - int32 V_6) - IL_0000: nop - IL_0001: ldc.i4.0 - IL_0002: stloc.0 - IL_0003: ldloc.0 - IL_0004: ldc.i4.s 11 - IL_0006: rem - IL_0007: ldc.i4.0 - IL_0008: ceq - IL_000a: stloc.1 - IL_000b: ldloc.1 - IL_000c: brfalse.s IL_0066 - - IL_000e: nop - IL_000f: br.s IL_005a - - IL_0011: nop - IL_0012: ldloc.0 - IL_0013: ldc.i4.4 - IL_0014: rem - IL_0015: ldc.i4.0 - IL_0016: ceq - IL_0018: stloc.2 - IL_0019: ldloc.2 - IL_001a: brfalse.s IL_0055 - - IL_001c: nop - IL_001d: ldloc.0 - IL_001e: ldc.i4.7 - IL_001f: rem - IL_0020: ldc.i4.0 - IL_0021: ceq - IL_0023: stloc.3 - IL_0024: ldloc.3 - IL_0025: brfalse.s IL_0046 - - IL_0027: nop - IL_0028: ldloc.0 - IL_0029: ldc.i4.s 11 - IL_002b: rem - IL_002c: ldc.i4.0 - IL_002d: ceq - IL_002f: stloc.s V_4 - IL_0031: ldloc.s V_4 - IL_0033: brfalse.s IL_0038 - - IL_0035: nop - IL_0036: br.s IL_005a - - IL_0038: ldstr "7" - IL_003d: call void [mscorlib]System.Console::WriteLine(string) - IL_0042: nop - IL_0043: nop - IL_0044: br.s IL_0053 - - IL_0046: nop - IL_0047: ldstr "!7" - IL_004c: call void [mscorlib]System.Console::WriteLine(string) - IL_0051: nop - IL_0052: nop - IL_0053: br.s IL_005f - - IL_0055: ldloc.0 - IL_0056: ldc.i4.1 - IL_0057: add - IL_0058: stloc.0 - IL_0059: nop - IL_005a: ldc.i4.1 - IL_005b: stloc.s V_5 - IL_005d: br.s IL_0011 - - IL_005f: ldc.i4 0x80000000 - IL_0064: stloc.0 - IL_0065: nop - IL_0066: ldloc.0 - IL_0067: stloc.s V_6 - IL_0069: br.s IL_006b - - IL_006b: ldloc.s V_6 - IL_006d: ret - } // end of method Loops::InterestingLoop - - .method private hidebysig instance bool - Condition(string arg) cil managed - { - // Code size 24 (0x18) - .maxstack 2 - .locals init (bool V_0) - IL_0000: nop - IL_0001: ldstr "Condition: " - IL_0006: ldarg.1 - IL_0007: call string [mscorlib]System.String::Concat(string, - string) - IL_000c: call void [mscorlib]System.Console::WriteLine(string) - IL_0011: nop - IL_0012: ldc.i4.0 - IL_0013: stloc.0 - IL_0014: br.s IL_0016 - - IL_0016: ldloc.0 - IL_0017: ret - } // end of method Loops::Condition - - .method public hidebysig instance void - WhileLoop() cil managed - { - // Code size 149 (0x95) - .maxstack 2 - .locals init (bool V_0, - bool V_1, - bool V_2, - bool V_3, - bool V_4) - IL_0000: nop - IL_0001: ldstr "Initial" - IL_0006: call void [mscorlib]System.Console::WriteLine(string) - IL_000b: nop - IL_000c: ldarg.0 - IL_000d: ldstr "if" - IL_0012: call instance bool Loops::Condition(string) - IL_0017: stloc.0 - IL_0018: ldloc.0 - IL_0019: brfalse.s IL_0089 - - IL_001b: nop - IL_001c: br.s IL_006c - - IL_001e: nop - IL_001f: ldstr "Loop Body" - IL_0024: call void [mscorlib]System.Console::WriteLine(string) - IL_0029: nop - IL_002a: ldarg.0 - IL_002b: ldstr "test" - IL_0030: call instance bool Loops::Condition(string) - IL_0035: stloc.1 - IL_0036: ldloc.1 - IL_0037: brfalse.s IL_0060 - - IL_0039: nop - IL_003a: ldarg.0 - IL_003b: ldstr "continue" - IL_0040: call instance bool Loops::Condition(string) - IL_0045: stloc.2 - IL_0046: ldloc.2 - IL_0047: brfalse.s IL_004b - - IL_0049: br.s IL_006c - - IL_004b: ldarg.0 - IL_004c: ldstr "break" - IL_0051: call instance bool Loops::Condition(string) - IL_0056: ldc.i4.0 - IL_0057: ceq - IL_0059: stloc.3 - IL_005a: ldloc.3 - IL_005b: brfalse.s IL_005f - - IL_005d: br.s IL_007d - - IL_005f: nop - IL_0060: ldstr "End of loop body" - IL_0065: call void [mscorlib]System.Console::WriteLine(string) - IL_006a: nop - IL_006b: nop - IL_006c: ldarg.0 - IL_006d: ldstr "while" - IL_0072: call instance bool Loops::Condition(string) - IL_0077: stloc.s V_4 - IL_0079: ldloc.s V_4 - IL_007b: brtrue.s IL_001e - - IL_007d: ldstr "After loop" - IL_0082: call void [mscorlib]System.Console::WriteLine(string) - IL_0087: nop - IL_0088: nop - IL_0089: ldstr "End of method" - IL_008e: call void [mscorlib]System.Console::WriteLine(string) - IL_0093: nop - IL_0094: ret - } // end of method Loops::WhileLoop - - .method public hidebysig instance void - DoWhileLoop() cil managed - { - // Code size 147 (0x93) - .maxstack 2 - .locals init (bool V_0, - bool V_1, - bool V_2, - bool V_3, - bool V_4) - IL_0000: nop - IL_0001: ldstr "Initial" - IL_0006: call void [mscorlib]System.Console::WriteLine(string) - IL_000b: nop - IL_000c: ldarg.0 - IL_000d: ldstr "if" - IL_0012: call instance bool Loops::Condition(string) - IL_0017: stloc.0 - IL_0018: ldloc.0 - IL_0019: brfalse.s IL_0087 - - IL_001b: nop - IL_001c: nop - IL_001d: ldstr "Loop Body" - IL_0022: call void [mscorlib]System.Console::WriteLine(string) - IL_0027: nop - IL_0028: ldarg.0 - IL_0029: ldstr "test" - IL_002e: call instance bool Loops::Condition(string) - IL_0033: stloc.1 - IL_0034: ldloc.1 - IL_0035: brfalse.s IL_005e - - IL_0037: nop - IL_0038: ldarg.0 - IL_0039: ldstr "continue" - IL_003e: call instance bool Loops::Condition(string) - IL_0043: stloc.2 - IL_0044: ldloc.2 - IL_0045: brfalse.s IL_0049 - - IL_0047: br.s IL_006a - - IL_0049: ldarg.0 - IL_004a: ldstr "break" - IL_004f: call instance bool Loops::Condition(string) - IL_0054: ldc.i4.0 - IL_0055: ceq - IL_0057: stloc.3 - IL_0058: ldloc.3 - IL_0059: brfalse.s IL_005d - - IL_005b: br.s IL_007b - - IL_005d: nop - IL_005e: ldstr "End of loop body" - IL_0063: call void [mscorlib]System.Console::WriteLine(string) - IL_0068: nop - IL_0069: nop - IL_006a: ldarg.0 - IL_006b: ldstr "while" - IL_0070: call instance bool Loops::Condition(string) - IL_0075: stloc.s V_4 - IL_0077: ldloc.s V_4 - IL_0079: brtrue.s IL_001c - - IL_007b: ldstr "After loop" - IL_0080: call void [mscorlib]System.Console::WriteLine(string) - IL_0085: nop - IL_0086: nop - IL_0087: ldstr "End of method" - IL_008c: call void [mscorlib]System.Console::WriteLine(string) - IL_0091: nop - IL_0092: ret - } // end of method Loops::DoWhileLoop - - .method public hidebysig instance void - ForLoop() cil managed - { - // Code size 157 (0x9d) - .maxstack 2 - .locals init (bool V_0, - int32 V_1, - bool V_2, - bool V_3, - bool V_4, - bool V_5) - IL_0000: nop - IL_0001: ldstr "Initial" - IL_0006: call void [mscorlib]System.Console::WriteLine(string) - IL_000b: nop - IL_000c: ldarg.0 - IL_000d: ldstr "if" - IL_0012: call instance bool Loops::Condition(string) - IL_0017: stloc.0 - IL_0018: ldloc.0 - IL_0019: brfalse.s IL_0091 - - IL_001b: nop - IL_001c: ldc.i4.0 - IL_001d: stloc.1 - IL_001e: br.s IL_0074 - - IL_0020: nop - IL_0021: ldstr "Loop Body" - IL_0026: call void [mscorlib]System.Console::WriteLine(string) - IL_002b: nop - IL_002c: ldarg.0 - IL_002d: ldstr "test" - IL_0032: call instance bool Loops::Condition(string) - IL_0037: stloc.2 - IL_0038: ldloc.2 - IL_0039: brfalse.s IL_0064 - - IL_003b: nop - IL_003c: ldarg.0 - IL_003d: ldstr "continue" - IL_0042: call instance bool Loops::Condition(string) - IL_0047: stloc.3 - IL_0048: ldloc.3 - IL_0049: brfalse.s IL_004d - - IL_004b: br.s IL_0070 - - IL_004d: ldarg.0 - IL_004e: ldstr "break" - IL_0053: call instance bool Loops::Condition(string) - IL_0058: ldc.i4.0 - IL_0059: ceq - IL_005b: stloc.s V_4 - IL_005d: ldloc.s V_4 - IL_005f: brfalse.s IL_0063 - - IL_0061: br.s IL_0085 - - IL_0063: nop - IL_0064: ldstr "End of loop body" - IL_0069: call void [mscorlib]System.Console::WriteLine(string) - IL_006e: nop - IL_006f: nop - IL_0070: ldloc.1 - IL_0071: ldc.i4.1 - IL_0072: add - IL_0073: stloc.1 - IL_0074: ldarg.0 - IL_0075: ldstr "for" - IL_007a: call instance bool Loops::Condition(string) - IL_007f: stloc.s V_5 - IL_0081: ldloc.s V_5 - IL_0083: brtrue.s IL_0020 - - IL_0085: ldstr "After loop" - IL_008a: call void [mscorlib]System.Console::WriteLine(string) - IL_008f: nop - IL_0090: nop - IL_0091: ldstr "End of method" - IL_0096: call void [mscorlib]System.Console::WriteLine(string) - IL_009b: nop - IL_009c: ret - } // end of method Loops::ForLoop - - .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 Loops::.ctor - -} // end of class Loops - - -// ============================================================= - -// *********** DISASSEMBLY COMPLETE *********************** diff --git a/ICSharpCode.Decompiler/Tests/TestCases/Pretty/ShortCircuit.il b/ICSharpCode.Decompiler/Tests/TestCases/Pretty/ShortCircuit.il index 057bd274c..cd6298230 100644 --- a/ICSharpCode.Decompiler/Tests/TestCases/Pretty/ShortCircuit.il +++ b/ICSharpCode.Decompiler/Tests/TestCases/Pretty/ShortCircuit.il @@ -1,5 +1,5 @@ -// Microsoft (R) .NET Framework IL Disassembler. Version 4.0.30319.18020 +// Microsoft (R) .NET Framework IL Disassembler. Version 4.0.30319.17929 // Copyright (c) Microsoft Corporation. All rights reserved. @@ -10,7 +10,7 @@ .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4.. .ver 4:0:0:0 } -.assembly '1usq3izz' +.assembly '0fqx5k1s' { .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 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.module '1usq3izz.dll' -// MVID: {D4D671C0-C178-4664-B3F2-149E3D2D1745} +.module '0fqx5k1s.dll' +// MVID: {40923C21-ED40-40E0-8D2A-58DE2CA84852} .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: 0x01380000 +// Image base: 0x031A0000 // =============== CLASS MEMBERS DECLARATION =================== diff --git a/ICSharpCode.Decompiler/Tests/TestCases/Pretty/ShortCircuit.opt.il b/ICSharpCode.Decompiler/Tests/TestCases/Pretty/ShortCircuit.opt.il index c3eda18aa..eb065bab6 100644 --- a/ICSharpCode.Decompiler/Tests/TestCases/Pretty/ShortCircuit.opt.il +++ b/ICSharpCode.Decompiler/Tests/TestCases/Pretty/ShortCircuit.opt.il @@ -1,5 +1,5 @@ -// Microsoft (R) .NET Framework IL Disassembler. Version 4.0.30319.18020 +// Microsoft (R) .NET Framework IL Disassembler. Version 4.0.30319.17929 // Copyright (c) Microsoft Corporation. All rights reserved. @@ -10,7 +10,7 @@ .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4.. .ver 4:0:0:0 } -.assembly kcfcwzhz +.assembly gbge3vmw { .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 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.module kcfcwzhz.dll -// MVID: {9375913F-19AE-4F80-AC4E-1691FD0225AD} +.module gbge3vmw.dll +// MVID: {39FE0BDC-C8CF-421C-936D-85782F68AEF4} .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: 0x01220000 +// Image base: 0x00C00000 // =============== CLASS MEMBERS DECLARATION =================== diff --git a/ICSharpCode.Decompiler/Tests/TestCases/Pretty/ShortCircuit.opt.roslyn.il b/ICSharpCode.Decompiler/Tests/TestCases/Pretty/ShortCircuit.opt.roslyn.il index 1a0788e0a..5717bd613 100644 --- a/ICSharpCode.Decompiler/Tests/TestCases/Pretty/ShortCircuit.opt.roslyn.il +++ b/ICSharpCode.Decompiler/Tests/TestCases/Pretty/ShortCircuit.opt.roslyn.il @@ -1,5 +1,5 @@ -// Microsoft (R) .NET Framework IL Disassembler. Version 4.0.30319.18020 +// Microsoft (R) .NET Framework IL Disassembler. Version 4.0.30319.17929 // Copyright (c) Microsoft Corporation. All rights reserved. @@ -32,7 +32,7 @@ .stackreserve 0x00100000 .subsystem 0x0003 // WINDOWS_CUI .corflags 0x00000001 // ILONLY -// Image base: 0x01320000 +// Image base: 0x02490000 // =============== CLASS MEMBERS DECLARATION =================== diff --git a/ICSharpCode.Decompiler/Tests/TestCases/Pretty/ShortCircuit.roslyn.il b/ICSharpCode.Decompiler/Tests/TestCases/Pretty/ShortCircuit.roslyn.il index 2a06238a3..20803869a 100644 --- a/ICSharpCode.Decompiler/Tests/TestCases/Pretty/ShortCircuit.roslyn.il +++ b/ICSharpCode.Decompiler/Tests/TestCases/Pretty/ShortCircuit.roslyn.il @@ -1,5 +1,5 @@ -// Microsoft (R) .NET Framework IL Disassembler. Version 4.0.30319.18020 +// Microsoft (R) .NET Framework IL Disassembler. Version 4.0.30319.17929 // Copyright (c) Microsoft Corporation. All rights reserved. @@ -32,7 +32,7 @@ .stackreserve 0x00100000 .subsystem 0x0003 // WINDOWS_CUI .corflags 0x00000001 // ILONLY -// Image base: 0x00FD0000 +// Image base: 0x00D60000 // =============== CLASS MEMBERS DECLARATION =================== diff --git a/ICSharpCode.Decompiler/Tests/TestCases/Pretty/YieldReturn.cs b/ICSharpCode.Decompiler/Tests/TestCases/Pretty/YieldReturn.cs index 7546b194f..5fe898780 100644 --- a/ICSharpCode.Decompiler/Tests/TestCases/Pretty/YieldReturn.cs +++ b/ICSharpCode.Decompiler/Tests/TestCases/Pretty/YieldReturn.cs @@ -19,130 +19,133 @@ using System; using System.Collections.Generic; -public static class YieldReturn +namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty { - public static IEnumerable SimpleYieldReturn() + public static class YieldReturn { - yield return "A"; - yield return "B"; - yield return "C"; - } - - public static IEnumerable YieldReturnInLoop() - { - for (int i = 0; i < 100; i++) { - yield return i; - } - } - - public static IEnumerable YieldReturnWithTryFinally() - { - yield return 0; - try { - yield return 1; - } finally { - Console.WriteLine("Finally!"); - } - yield return 2; - } - - public static IEnumerable YieldReturnInLock1(object o) - { - lock (o) { - yield return 1; + public static IEnumerable SimpleYieldReturn() + { + yield return "A"; + yield return "B"; + yield return "C"; } - } - - public static IEnumerable YieldReturnInLock2(object o) - { - lock (o) { - yield return 1; - o = null; - yield return 2; + + public static IEnumerable YieldReturnInLoop() + { + for (int i = 0; i < 100; i++) { + yield return i; + } } - } - - public static IEnumerable YieldReturnWithNestedTryFinally(bool breakInMiddle) - { - Console.WriteLine("Start of method - 1"); - yield return "Start of method"; - Console.WriteLine("Start of method - 2"); - try { - Console.WriteLine("Within outer try - 1"); - yield return "Within outer try"; - Console.WriteLine("Within outer try - 2"); + + public static IEnumerable YieldReturnWithTryFinally() + { + yield return 0; try { - Console.WriteLine("Within inner try - 1"); - yield return "Within inner try"; - Console.WriteLine("Within inner try - 2"); - if (breakInMiddle) - yield break; - Console.WriteLine("End of inner try - 1"); - yield return "End of inner try"; - Console.WriteLine("End of inner try - 2"); + yield return 1; } finally { - Console.WriteLine("Inner Finally"); + Console.WriteLine("Finally!"); + } + yield return 2; + } + + public static IEnumerable YieldReturnInLock1(object o) + { + lock (o) { + yield return 1; } - Console.WriteLine("End of outer try - 1"); - yield return "End of outer try"; - Console.WriteLine("End of outer try - 2"); - } finally { - Console.WriteLine("Outer Finally"); } - Console.WriteLine("End of method - 1"); - yield return "End of method"; - Console.WriteLine("End of method - 2"); - } - - public static IEnumerable YieldReturnWithTwoNonNestedFinallyBlocks(IEnumerable input) - { - // outer try-finally block - foreach (string line in input) { - // nested try-finally block + + public static IEnumerable YieldReturnInLock2(object o) + { + lock (o) { + yield return 1; + o = null; + yield return 2; + } + } + + public static IEnumerable YieldReturnWithNestedTryFinally(bool breakInMiddle) + { + Console.WriteLine("Start of method - 1"); + yield return "Start of method"; + Console.WriteLine("Start of method - 2"); try { - yield return line; + Console.WriteLine("Within outer try - 1"); + yield return "Within outer try"; + Console.WriteLine("Within outer try - 2"); + try { + Console.WriteLine("Within inner try - 1"); + yield return "Within inner try"; + Console.WriteLine("Within inner try - 2"); + if (breakInMiddle) + yield break; + Console.WriteLine("End of inner try - 1"); + yield return "End of inner try"; + Console.WriteLine("End of inner try - 2"); + } finally { + Console.WriteLine("Inner Finally"); + } + Console.WriteLine("End of outer try - 1"); + yield return "End of outer try"; + Console.WriteLine("End of outer try - 2"); } finally { - Console.WriteLine("Processed " + line); + Console.WriteLine("Outer Finally"); } + Console.WriteLine("End of method - 1"); + yield return "End of method"; + Console.WriteLine("End of method - 2"); } - yield return "A"; - yield return "B"; - yield return "C"; - yield return "D"; - yield return "E"; - yield return "F"; - // outer try-finally block - foreach (string line in input) - yield return line.ToUpper(); - } - - public static IEnumerable> YieldReturnWithAnonymousMethods1(IEnumerable input) - { - foreach (string line in input) { - yield return () => line; + + public static IEnumerable YieldReturnWithTwoNonNestedFinallyBlocks(IEnumerable input) + { + // outer try-finally block + foreach (string line in input) { + // nested try-finally block + try { + yield return line; + } finally { + Console.WriteLine("Processed " + line); + } + } + yield return "A"; + yield return "B"; + yield return "C"; + yield return "D"; + yield return "E"; + yield return "F"; + // outer try-finally block + foreach (string line in input) + yield return line.ToUpper(); } - } - - public static IEnumerable> YieldReturnWithAnonymousMethods2(IEnumerable input) - { - foreach (string line in input) { - string copy = line; - yield return () => copy; + + public static IEnumerable> YieldReturnWithAnonymousMethods1(IEnumerable input) + { + foreach (string line in input) { + yield return () => line; + } } - } - - public static IEnumerable GetEvenNumbers(int n) - { - for (int i = 0; i < n; i++) { - if (i % 2 == 0) - yield return i; + + public static IEnumerable> YieldReturnWithAnonymousMethods2(IEnumerable input) + { + foreach (string line in input) { + string copy = line; + yield return () => copy; + } + } + + public static IEnumerable GetEvenNumbers(int n) + { + for (int i = 0; i < n; i++) { + if (i % 2 == 0) + yield return i; + } + } + + public static IEnumerable YieldChars() + { + yield return 'a'; + yield return 'b'; + yield return 'c'; } } - - public static IEnumerable YieldChars() - { - yield return 'a'; - yield return 'b'; - yield return 'c'; - } -} +} \ No newline at end of file