diff --git a/ICSharpCode.Decompiler.Tests/TestCases/Correctness/Loops.cs b/ICSharpCode.Decompiler.Tests/TestCases/Correctness/Loops.cs index c0958dc5f..1559d14ad 100644 --- a/ICSharpCode.Decompiler.Tests/TestCases/Correctness/Loops.cs +++ b/ICSharpCode.Decompiler.Tests/TestCases/Correctness/Loops.cs @@ -27,14 +27,21 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness { class Loops { + static void Operation(ref int item) + { + item++; + } + static void Main() { ForWithMultipleVariables(); DoubleForEachWithSameVariable(new[] { "a", "b", "c" }); ForeachExceptForNameCollision(new[] { 42, 43, 44, 45 }); + ForeachExceptForContinuedUse(new[] { 42, 43, 44, 45 }); NonGenericForeachWithReturnFallbackTest(new object[] { "a", 42, "b", 43 }); NonGenericForeachWithReturn(new object[] { "a", 42, "b", 43 }); ForeachWithReturn(new[] { 42, 43, 44, 45 }); + ForeachWithRefUsage(new List { 1, 2, 3, 4, 5 }); } public static void ForWithMultipleVariables() @@ -75,6 +82,19 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness Console.WriteLine(current); } + public static void ForeachExceptForContinuedUse(IEnumerable inputs) + { + Console.WriteLine("ForeachExceptForContinuedUse"); + int num = 0; + using (IEnumerator enumerator = inputs.GetEnumerator()) { + while (enumerator.MoveNext()) { + num = enumerator.Current; + Console.WriteLine(num); + } + } + Console.WriteLine("Last: " + num); + } + public static void NonGenericForeachWithReturnFallbackTest(IEnumerable e) { Console.WriteLine("NonGenericForeachWithReturnFallback:"); @@ -117,5 +137,16 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness Console.WriteLine("return: null"); return null; } + + public static void ForeachWithRefUsage(List items) + { + Console.WriteLine("ForeachWithRefUsage:"); + foreach (var item in items) { + var itemToChange = item; + Console.WriteLine("item: " + item); + Operation(ref itemToChange); + Console.WriteLine("item: " + itemToChange); + } + } } } diff --git a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/Loops.cs b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/Loops.cs index 113288a80..22352ce7f 100644 --- a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/Loops.cs +++ b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/Loops.cs @@ -19,11 +19,243 @@ using System; using System.Collections; using System.Collections.Generic; +using System.Runtime.InteropServices; namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty { public class Loops { + #region foreach + public class CustomClassEnumerator + { + public object Current { + get { + throw new NotImplementedException(); + } + } + + public bool MoveNext() + { + throw new NotImplementedException(); + } + + public void Reset() + { + throw new NotImplementedException(); + } + + public CustomClassEnumerator GetEnumerator() + { + return this; + } + } + + [StructLayout(LayoutKind.Sequential, Size = 1)] + public struct CustomStructEnumerator + { + public object Current { + get { + throw new NotImplementedException(); + } + } + + public bool MoveNext() + { + throw new NotImplementedException(); + } + + public void Reset() + { + throw new NotImplementedException(); + } + + public CustomStructEnumerator GetEnumerator() + { + return this; + } + } + + public class CustomClassEnumerator + { + public T Current { + get { + throw new NotImplementedException(); + } + } + + public void Dispose() + { + throw new NotImplementedException(); + } + + public bool MoveNext() + { + throw new NotImplementedException(); + } + + public void Reset() + { + throw new NotImplementedException(); + } + + public CustomClassEnumerator GetEnumerator() + { + return this; + } + } + + [StructLayout(LayoutKind.Sequential, Size = 1)] + public struct CustomStructEnumerator + { + public T Current { + get { + throw new NotImplementedException(); + } + } + + public void Dispose() + { + throw new NotImplementedException(); + } + + public bool MoveNext() + { + throw new NotImplementedException(); + } + + public void Reset() + { + throw new NotImplementedException(); + } + + public CustomStructEnumerator GetEnumerator() + { + return this; + } + } + + public class CustomClassEnumeratorWithIDisposable : IDisposable + { + public object Current { + get { + throw new NotImplementedException(); + } + } + + public void Dispose() + { + throw new NotImplementedException(); + } + + public bool MoveNext() + { + throw new NotImplementedException(); + } + + public void Reset() + { + throw new NotImplementedException(); + } + + public CustomClassEnumeratorWithIDisposable GetEnumerator() + { + return this; + } + } + + [StructLayout(LayoutKind.Sequential, Size = 1)] + public struct CustomStructEnumeratorWithIDisposable : IDisposable + { + public object Current { + get { + throw new NotImplementedException(); + } + } + + public void Dispose() + { + throw new NotImplementedException(); + } + + public bool MoveNext() + { + throw new NotImplementedException(); + } + + public void Reset() + { + throw new NotImplementedException(); + } + + public CustomStructEnumeratorWithIDisposable GetEnumerator() + { + return this; + } + } + + public class CustomClassEnumeratorWithIDisposable : IDisposable + { + public T Current { + get { + throw new NotImplementedException(); + } + } + + public void Dispose() + { + throw new NotImplementedException(); + } + + public bool MoveNext() + { + throw new NotImplementedException(); + } + + public void Reset() + { + throw new NotImplementedException(); + } + + public CustomClassEnumeratorWithIDisposable GetEnumerator() + { + return this; + } + } + + [StructLayout(LayoutKind.Sequential, Size = 1)] + public struct CustomStructEnumeratorWithIDisposable : IDisposable + { + public T Current { + get { + throw new NotImplementedException(); + } + } + + public void Dispose() + { + throw new NotImplementedException(); + } + + public bool MoveNext() + { + throw new NotImplementedException(); + } + + public void Reset() + { + throw new NotImplementedException(); + } + + public CustomStructEnumeratorWithIDisposable GetEnumerator() + { + return this; + } + } + + private static void Operation(ref int item) + { + } + public void ForEach(IEnumerable enumerable) { foreach (string item in enumerable) { @@ -60,13 +292,100 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty } } - // public void ForEachOverArray(string[] array) - // { - // foreach (string text in array) - // { - // text.ToLower(); - // } - // } + public void ForEachOnCustomClassEnumerator(CustomClassEnumerator e) + { + foreach (object item in e) { + Console.WriteLine(item); + } + } + + // TODO : Needs additional pattern detection + // CustomStructEnumerator does not implement IDisposable + // No try-finally-Dispose is generated. + //public void ForEachOnCustomStructEnumerator(CustomStructEnumerator e) + //{ + // foreach (object item in e) { + // Console.WriteLine(item); + // } + //} + + public void ForEachOnGenericCustomClassEnumerator(CustomClassEnumerator e) + { + foreach (T item in e) { + Console.WriteLine(item); + } + } + + // TODO : Needs additional pattern detection + // CustomStructEnumerator does not implement IDisposable + // No try-finally-Dispose is generated. + //public void ForEachOnGenericCustomStructEnumerator(CustomStructEnumerator e) + //{ + // foreach (T item in e) { + // Console.WriteLine(item); + // } + //} + + public void ForEachOnCustomClassEnumeratorWithIDisposable(CustomClassEnumeratorWithIDisposable e) + { + foreach (object item in e) { + Console.WriteLine(item); + } + } + + public void ForEachOnCustomStructEnumeratorWithIDisposable(CustomStructEnumeratorWithIDisposable e) + { + foreach (object item in e) { + Console.WriteLine(item); + } + } + + public void ForEachOnGenericCustomClassEnumeratorWithIDisposable(CustomClassEnumeratorWithIDisposable e) + { + foreach (T item in e) { + Console.WriteLine(item); + } + } + + public void ForEachOnGenericCustomStructEnumeratorWithIDisposable(CustomStructEnumeratorWithIDisposable e) + { + foreach (T item in e) { + Console.WriteLine(item); + } + } + + public static void NonGenericForeachWithReturnFallbackTest(IEnumerable e) + { + Console.WriteLine("NonGenericForeachWithReturnFallback:"); + IEnumerator enumerator = e.GetEnumerator(); + try { + Console.WriteLine("MoveNext"); + if (enumerator.MoveNext()) { + object current = enumerator.Current; + Console.WriteLine("current: " + current); + } + } finally { + IDisposable disposable = enumerator as IDisposable; + if (disposable != null) + disposable.Dispose(); + } + Console.WriteLine("After finally!"); + } + + public static void ForeachWithRefUsage(List items) + { + foreach (int item in items) { + int current = item; + Loops.Operation(ref current); + } + } + #endregion + //public void ForEachOverArray(string[] array) + //{ + // foreach (string text in array) { + // text.ToLower(); + // } + //} public void ForOverArray(string[] array) { @@ -207,36 +526,5 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty } Console.WriteLine("End of method"); } - - public static void ForeachExceptForContinuedUse(IEnumerable inputs) - { - Console.WriteLine("ForeachExceptForContinuedUse"); - int num = 0; - using (IEnumerator enumerator = inputs.GetEnumerator()) { - while (enumerator.MoveNext()) { - num = enumerator.Current; - Console.WriteLine(num); - } - } - Console.WriteLine("Last: " + num); - } - - public static void NonGenericForeachWithReturnFallbackTest(IEnumerable e) - { - Console.WriteLine("NonGenericForeachWithReturnFallback:"); - IEnumerator enumerator = e.GetEnumerator(); - try { - Console.WriteLine("MoveNext"); - if (enumerator.MoveNext()) { - object current = enumerator.Current; - Console.WriteLine("current: " + current); - } - } finally { - IDisposable disposable = enumerator as IDisposable; - if (disposable != null) - disposable.Dispose(); - } - Console.WriteLine("After finally!"); - } } } diff --git a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/Loops.il b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/Loops.il index ae3d4d573..437cfdfd7 100644 --- a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/Loops.il +++ b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/Loops.il @@ -10,7 +10,7 @@ .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4.. .ver 4:0:0:0 } -.assembly kpve0joz +.assembly tv41vlwg { .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 kpve0joz.dll -// MVID: {20825129-FBF4-4D0D-B2DB-BB2FE12F3807} +.module tv41vlwg.dll +// MVID: {4100A512-8776-4CC7-9C57-3B897002C50E} .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: 0x02A50000 +// Image base: 0x02EF0000 // =============== CLASS MEMBERS DECLARATION =================== @@ -36,6 +36,562 @@ .class public auto ansi beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops extends [mscorlib]System.Object { + .class auto ansi nested public beforefieldinit CustomClassEnumerator + extends [mscorlib]System.Object + { + .method public hidebysig specialname + instance object get_Current() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: nop + IL_0001: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0006: throw + } // end of method CustomClassEnumerator::get_Current + + .method public hidebysig instance bool + MoveNext() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: nop + IL_0001: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0006: throw + } // end of method CustomClassEnumerator::MoveNext + + .method public hidebysig instance void + Reset() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: nop + IL_0001: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0006: throw + } // end of method CustomClassEnumerator::Reset + + .method public hidebysig instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumerator + GetEnumerator() cil managed + { + // Code size 7 (0x7) + .maxstack 1 + .locals init (class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumerator V_0) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: stloc.0 + IL_0003: br.s IL_0005 + + IL_0005: ldloc.0 + IL_0006: ret + } // end of method CustomClassEnumerator::GetEnumerator + + .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 CustomClassEnumerator::.ctor + + .property instance object Current() + { + .get instance object ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumerator::get_Current() + } // end of property CustomClassEnumerator::Current + } // end of class CustomClassEnumerator + + .class sequential ansi sealed nested public beforefieldinit CustomStructEnumerator + extends [mscorlib]System.ValueType + { + .pack 0 + .size 1 + .method public hidebysig specialname + instance object get_Current() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: nop + IL_0001: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0006: throw + } // end of method CustomStructEnumerator::get_Current + + .method public hidebysig instance bool + MoveNext() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: nop + IL_0001: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0006: throw + } // end of method CustomStructEnumerator::MoveNext + + .method public hidebysig instance void + Reset() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: nop + IL_0001: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0006: throw + } // end of method CustomStructEnumerator::Reset + + .method public hidebysig instance valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumerator + GetEnumerator() cil managed + { + // Code size 12 (0xc) + .maxstack 1 + .locals init (valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumerator V_0) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldobj ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumerator + IL_0007: stloc.0 + IL_0008: br.s IL_000a + + IL_000a: ldloc.0 + IL_000b: ret + } // end of method CustomStructEnumerator::GetEnumerator + + .property instance object Current() + { + .get instance object ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumerator::get_Current() + } // end of property CustomStructEnumerator::Current + } // end of class CustomStructEnumerator + + .class auto ansi nested public beforefieldinit CustomClassEnumerator`1 + extends [mscorlib]System.Object + { + .method public hidebysig specialname + instance !T get_Current() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: nop + IL_0001: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0006: throw + } // end of method CustomClassEnumerator`1::get_Current + + .method public hidebysig instance void + Dispose() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: nop + IL_0001: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0006: throw + } // end of method CustomClassEnumerator`1::Dispose + + .method public hidebysig instance bool + MoveNext() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: nop + IL_0001: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0006: throw + } // end of method CustomClassEnumerator`1::MoveNext + + .method public hidebysig instance void + Reset() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: nop + IL_0001: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0006: throw + } // end of method CustomClassEnumerator`1::Reset + + .method public hidebysig instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumerator`1 + GetEnumerator() cil managed + { + // Code size 7 (0x7) + .maxstack 1 + .locals init (class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumerator`1 V_0) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: stloc.0 + IL_0003: br.s IL_0005 + + IL_0005: ldloc.0 + IL_0006: ret + } // end of method CustomClassEnumerator`1::GetEnumerator + + .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 CustomClassEnumerator`1::.ctor + + .property instance !T Current() + { + .get instance !T ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumerator`1::get_Current() + } // end of property CustomClassEnumerator`1::Current + } // end of class CustomClassEnumerator`1 + + .class sequential ansi sealed nested public beforefieldinit CustomStructEnumerator`1 + extends [mscorlib]System.ValueType + { + .pack 0 + .size 1 + .method public hidebysig specialname + instance !T get_Current() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: nop + IL_0001: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0006: throw + } // end of method CustomStructEnumerator`1::get_Current + + .method public hidebysig instance void + Dispose() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: nop + IL_0001: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0006: throw + } // end of method CustomStructEnumerator`1::Dispose + + .method public hidebysig instance bool + MoveNext() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: nop + IL_0001: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0006: throw + } // end of method CustomStructEnumerator`1::MoveNext + + .method public hidebysig instance void + Reset() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: nop + IL_0001: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0006: throw + } // end of method CustomStructEnumerator`1::Reset + + .method public hidebysig instance valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumerator`1 + GetEnumerator() cil managed + { + // Code size 12 (0xc) + .maxstack 1 + .locals init (valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumerator`1 V_0) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldobj valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumerator`1 + IL_0007: stloc.0 + IL_0008: br.s IL_000a + + IL_000a: ldloc.0 + IL_000b: ret + } // end of method CustomStructEnumerator`1::GetEnumerator + + .property instance !T Current() + { + .get instance !T ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumerator`1::get_Current() + } // end of property CustomStructEnumerator`1::Current + } // end of class CustomStructEnumerator`1 + + .class auto ansi nested public beforefieldinit CustomClassEnumeratorWithIDisposable + extends [mscorlib]System.Object + implements [mscorlib]System.IDisposable + { + .method public hidebysig specialname + instance object get_Current() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: nop + IL_0001: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0006: throw + } // end of method CustomClassEnumeratorWithIDisposable::get_Current + + .method public hidebysig newslot virtual final + instance void Dispose() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: nop + IL_0001: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0006: throw + } // end of method CustomClassEnumeratorWithIDisposable::Dispose + + .method public hidebysig instance bool + MoveNext() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: nop + IL_0001: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0006: throw + } // end of method CustomClassEnumeratorWithIDisposable::MoveNext + + .method public hidebysig instance void + Reset() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: nop + IL_0001: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0006: throw + } // end of method CustomClassEnumeratorWithIDisposable::Reset + + .method public hidebysig instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumeratorWithIDisposable + GetEnumerator() cil managed + { + // Code size 7 (0x7) + .maxstack 1 + .locals init (class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumeratorWithIDisposable V_0) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: stloc.0 + IL_0003: br.s IL_0005 + + IL_0005: ldloc.0 + IL_0006: ret + } // end of method CustomClassEnumeratorWithIDisposable::GetEnumerator + + .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 CustomClassEnumeratorWithIDisposable::.ctor + + .property instance object Current() + { + .get instance object ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumeratorWithIDisposable::get_Current() + } // end of property CustomClassEnumeratorWithIDisposable::Current + } // end of class CustomClassEnumeratorWithIDisposable + + .class sequential ansi sealed nested public beforefieldinit CustomStructEnumeratorWithIDisposable + extends [mscorlib]System.ValueType + implements [mscorlib]System.IDisposable + { + .pack 0 + .size 1 + .method public hidebysig specialname + instance object get_Current() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: nop + IL_0001: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0006: throw + } // end of method CustomStructEnumeratorWithIDisposable::get_Current + + .method public hidebysig newslot virtual final + instance void Dispose() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: nop + IL_0001: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0006: throw + } // end of method CustomStructEnumeratorWithIDisposable::Dispose + + .method public hidebysig instance bool + MoveNext() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: nop + IL_0001: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0006: throw + } // end of method CustomStructEnumeratorWithIDisposable::MoveNext + + .method public hidebysig instance void + Reset() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: nop + IL_0001: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0006: throw + } // end of method CustomStructEnumeratorWithIDisposable::Reset + + .method public hidebysig instance valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable + GetEnumerator() cil managed + { + // Code size 12 (0xc) + .maxstack 1 + .locals init (valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable V_0) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldobj ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable + IL_0007: stloc.0 + IL_0008: br.s IL_000a + + IL_000a: ldloc.0 + IL_000b: ret + } // end of method CustomStructEnumeratorWithIDisposable::GetEnumerator + + .property instance object Current() + { + .get instance object ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable::get_Current() + } // end of property CustomStructEnumeratorWithIDisposable::Current + } // end of class CustomStructEnumeratorWithIDisposable + + .class auto ansi nested public beforefieldinit CustomClassEnumeratorWithIDisposable`1 + extends [mscorlib]System.Object + implements [mscorlib]System.IDisposable + { + .method public hidebysig specialname + instance !T get_Current() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: nop + IL_0001: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0006: throw + } // end of method CustomClassEnumeratorWithIDisposable`1::get_Current + + .method public hidebysig newslot virtual final + instance void Dispose() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: nop + IL_0001: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0006: throw + } // end of method CustomClassEnumeratorWithIDisposable`1::Dispose + + .method public hidebysig instance bool + MoveNext() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: nop + IL_0001: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0006: throw + } // end of method CustomClassEnumeratorWithIDisposable`1::MoveNext + + .method public hidebysig instance void + Reset() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: nop + IL_0001: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0006: throw + } // end of method CustomClassEnumeratorWithIDisposable`1::Reset + + .method public hidebysig instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumeratorWithIDisposable`1 + GetEnumerator() cil managed + { + // Code size 7 (0x7) + .maxstack 1 + .locals init (class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumeratorWithIDisposable`1 V_0) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: stloc.0 + IL_0003: br.s IL_0005 + + IL_0005: ldloc.0 + IL_0006: ret + } // end of method CustomClassEnumeratorWithIDisposable`1::GetEnumerator + + .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 CustomClassEnumeratorWithIDisposable`1::.ctor + + .property instance !T Current() + { + .get instance !T ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumeratorWithIDisposable`1::get_Current() + } // end of property CustomClassEnumeratorWithIDisposable`1::Current + } // end of class CustomClassEnumeratorWithIDisposable`1 + + .class sequential ansi sealed nested public beforefieldinit CustomStructEnumeratorWithIDisposable`1 + extends [mscorlib]System.ValueType + implements [mscorlib]System.IDisposable + { + .pack 0 + .size 1 + .method public hidebysig specialname + instance !T get_Current() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: nop + IL_0001: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0006: throw + } // end of method CustomStructEnumeratorWithIDisposable`1::get_Current + + .method public hidebysig newslot virtual final + instance void Dispose() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: nop + IL_0001: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0006: throw + } // end of method CustomStructEnumeratorWithIDisposable`1::Dispose + + .method public hidebysig instance bool + MoveNext() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: nop + IL_0001: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0006: throw + } // end of method CustomStructEnumeratorWithIDisposable`1::MoveNext + + .method public hidebysig instance void + Reset() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: nop + IL_0001: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0006: throw + } // end of method CustomStructEnumeratorWithIDisposable`1::Reset + + .method public hidebysig instance valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable`1 + GetEnumerator() cil managed + { + // Code size 12 (0xc) + .maxstack 1 + .locals init (valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable`1 V_0) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldobj valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable`1 + IL_0007: stloc.0 + IL_0008: br.s IL_000a + + IL_000a: ldloc.0 + IL_000b: ret + } // end of method CustomStructEnumeratorWithIDisposable`1::GetEnumerator + + .property instance !T Current() + { + .get instance !T ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable`1::get_Current() + } // end of property CustomStructEnumeratorWithIDisposable`1::Current + } // end of class CustomStructEnumeratorWithIDisposable`1 + + .method private hidebysig static void Operation(int32& item) cil managed + { + // Code size 2 (0x2) + .maxstack 8 + IL_0000: nop + IL_0001: ret + } // end of method Loops::Operation + .method public hidebysig instance void ForEach(class [mscorlib]System.Collections.Generic.IEnumerable`1 enumerable) cil managed { @@ -304,6 +860,435 @@ IL_0044: ret } // end of method Loops::ForEachOverNonGenericEnumerableWithAutomaticCastRefType + .method public hidebysig instance void + ForEachOnCustomClassEnumerator(class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumerator e) cil managed + { + // Code size 64 (0x40) + .maxstack 2 + .locals init (object V_0, + class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumerator 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 ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumerator ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumerator::GetEnumerator() + IL_0008: stloc.1 + .try + { + IL_0009: br.s IL_001b + + IL_000b: ldloc.1 + IL_000c: callvirt instance object ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumerator::get_Current() + IL_0011: stloc.0 + IL_0012: nop + IL_0013: ldloc.0 + IL_0014: call void [mscorlib]System.Console::WriteLine(object) + IL_0019: nop + IL_001a: nop + IL_001b: ldloc.1 + IL_001c: callvirt instance bool ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumerator::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::ForEachOnCustomClassEnumerator + + .method public hidebysig instance void + ForEachOnGenericCustomClassEnumerator(class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumerator`1 e) cil managed + { + // Code size 69 (0x45) + .maxstack 2 + .locals init (!!T V_0, + class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumerator`1 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 ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumerator`1 class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumerator`1::GetEnumerator() + IL_0008: stloc.1 + .try + { + IL_0009: br.s IL_0020 + + IL_000b: ldloc.1 + IL_000c: callvirt instance !0 class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumerator`1::get_Current() + IL_0011: stloc.0 + IL_0012: nop + IL_0013: ldloc.0 + IL_0014: box !!T + IL_0019: call void [mscorlib]System.Console::WriteLine(object) + IL_001e: nop + IL_001f: nop + IL_0020: ldloc.1 + IL_0021: callvirt instance bool class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumerator`1::MoveNext() + IL_0026: stloc.2 + IL_0027: ldloc.2 + IL_0028: brtrue.s IL_000b + + IL_002a: leave.s IL_0043 + + } // end .try + finally + { + IL_002c: ldloc.1 + IL_002d: isinst [mscorlib]System.IDisposable + IL_0032: stloc.3 + IL_0033: ldloc.3 + IL_0034: ldnull + IL_0035: ceq + IL_0037: stloc.2 + IL_0038: ldloc.2 + IL_0039: brtrue.s IL_0042 + + IL_003b: ldloc.3 + IL_003c: callvirt instance void [mscorlib]System.IDisposable::Dispose() + IL_0041: nop + IL_0042: endfinally + } // end handler + IL_0043: nop + IL_0044: ret + } // end of method Loops::ForEachOnGenericCustomClassEnumerator + + .method public hidebysig instance void + ForEachOnCustomClassEnumeratorWithIDisposable(class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumeratorWithIDisposable e) cil managed + { + // Code size 57 (0x39) + .maxstack 2 + .locals init (object V_0, + class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumeratorWithIDisposable V_1, + bool V_2) + IL_0000: nop + IL_0001: nop + IL_0002: ldarg.1 + IL_0003: callvirt instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumeratorWithIDisposable ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumeratorWithIDisposable::GetEnumerator() + IL_0008: stloc.1 + .try + { + IL_0009: br.s IL_001b + + IL_000b: ldloc.1 + IL_000c: callvirt instance object ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumeratorWithIDisposable::get_Current() + IL_0011: stloc.0 + IL_0012: nop + IL_0013: ldloc.0 + IL_0014: call void [mscorlib]System.Console::WriteLine(object) + IL_0019: nop + IL_001a: nop + IL_001b: ldloc.1 + IL_001c: callvirt instance bool ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumeratorWithIDisposable::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::ForEachOnCustomClassEnumeratorWithIDisposable + + .method public hidebysig instance void + ForEachOnCustomStructEnumeratorWithIDisposable(valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable e) cil managed + { + // Code size 59 (0x3b) + .maxstack 1 + .locals init (object V_0, + valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable V_1, + bool V_2) + IL_0000: nop + IL_0001: nop + IL_0002: ldarga.s e + IL_0004: call instance valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable::GetEnumerator() + IL_0009: stloc.1 + .try + { + IL_000a: br.s IL_001d + + IL_000c: ldloca.s V_1 + IL_000e: call instance object ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable::get_Current() + IL_0013: stloc.0 + IL_0014: nop + IL_0015: ldloc.0 + IL_0016: call void [mscorlib]System.Console::WriteLine(object) + IL_001b: nop + IL_001c: nop + IL_001d: ldloca.s V_1 + IL_001f: call instance bool ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable::MoveNext() + IL_0024: stloc.2 + IL_0025: ldloc.2 + IL_0026: brtrue.s IL_000c + + IL_0028: leave.s IL_0039 + + } // end .try + finally + { + IL_002a: ldloca.s V_1 + IL_002c: constrained. ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable + IL_0032: callvirt instance void [mscorlib]System.IDisposable::Dispose() + IL_0037: nop + IL_0038: endfinally + } // end handler + IL_0039: nop + IL_003a: ret + } // end of method Loops::ForEachOnCustomStructEnumeratorWithIDisposable + + .method public hidebysig instance void + ForEachOnGenericCustomClassEnumeratorWithIDisposable(class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumeratorWithIDisposable`1 e) cil managed + { + // Code size 62 (0x3e) + .maxstack 2 + .locals init (!!T V_0, + class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumeratorWithIDisposable`1 V_1, + bool V_2) + IL_0000: nop + IL_0001: nop + IL_0002: ldarg.1 + IL_0003: callvirt instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumeratorWithIDisposable`1 class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumeratorWithIDisposable`1::GetEnumerator() + IL_0008: stloc.1 + .try + { + IL_0009: br.s IL_0020 + + IL_000b: ldloc.1 + IL_000c: callvirt instance !0 class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumeratorWithIDisposable`1::get_Current() + IL_0011: stloc.0 + IL_0012: nop + IL_0013: ldloc.0 + IL_0014: box !!T + IL_0019: call void [mscorlib]System.Console::WriteLine(object) + IL_001e: nop + IL_001f: nop + IL_0020: ldloc.1 + IL_0021: callvirt instance bool class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumeratorWithIDisposable`1::MoveNext() + IL_0026: stloc.2 + IL_0027: ldloc.2 + IL_0028: brtrue.s IL_000b + + IL_002a: leave.s IL_003c + + } // end .try + finally + { + IL_002c: ldloc.1 + IL_002d: ldnull + IL_002e: ceq + IL_0030: stloc.2 + IL_0031: ldloc.2 + IL_0032: brtrue.s IL_003b + + IL_0034: ldloc.1 + IL_0035: callvirt instance void [mscorlib]System.IDisposable::Dispose() + IL_003a: nop + IL_003b: endfinally + } // end handler + IL_003c: nop + IL_003d: ret + } // end of method Loops::ForEachOnGenericCustomClassEnumeratorWithIDisposable + + .method public hidebysig instance void + ForEachOnGenericCustomStructEnumeratorWithIDisposable(valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable`1 e) cil managed + { + // Code size 64 (0x40) + .maxstack 1 + .locals init (!!T V_0, + valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable`1 V_1, + bool V_2) + IL_0000: nop + IL_0001: nop + IL_0002: ldarga.s e + IL_0004: call instance valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable`1 valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable`1::GetEnumerator() + IL_0009: stloc.1 + .try + { + IL_000a: br.s IL_0022 + + IL_000c: ldloca.s V_1 + IL_000e: call instance !0 valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable`1::get_Current() + IL_0013: stloc.0 + IL_0014: nop + IL_0015: ldloc.0 + IL_0016: box !!T + IL_001b: call void [mscorlib]System.Console::WriteLine(object) + IL_0020: nop + IL_0021: nop + IL_0022: ldloca.s V_1 + IL_0024: call instance bool valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable`1::MoveNext() + IL_0029: stloc.2 + IL_002a: ldloc.2 + IL_002b: brtrue.s IL_000c + + IL_002d: leave.s IL_003e + + } // end .try + finally + { + IL_002f: ldloca.s V_1 + IL_0031: constrained. valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable`1 + 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::ForEachOnGenericCustomStructEnumeratorWithIDisposable + + .method public hidebysig static void NonGenericForeachWithReturnFallbackTest(class [mscorlib]System.Collections.IEnumerable e) cil managed + { + // Code size 111 (0x6f) + .maxstack 2 + .locals init (class [mscorlib]System.Collections.IEnumerator V_0, + object V_1, + class [mscorlib]System.IDisposable V_2, + bool V_3) + IL_0000: nop + IL_0001: ldstr "NonGenericForeachWithReturnFallback:" + IL_0006: call void [mscorlib]System.Console::WriteLine(string) + IL_000b: nop + IL_000c: ldarg.0 + IL_000d: callvirt instance class [mscorlib]System.Collections.IEnumerator [mscorlib]System.Collections.IEnumerable::GetEnumerator() + IL_0012: stloc.0 + .try + { + IL_0013: nop + IL_0014: ldstr "MoveNext" + IL_0019: call void [mscorlib]System.Console::WriteLine(string) + IL_001e: nop + IL_001f: ldloc.0 + IL_0020: callvirt instance bool [mscorlib]System.Collections.IEnumerator::MoveNext() + IL_0025: ldc.i4.0 + IL_0026: ceq + IL_0028: stloc.3 + IL_0029: ldloc.3 + IL_002a: brtrue.s IL_0046 + + IL_002c: nop + IL_002d: ldloc.0 + IL_002e: callvirt instance object [mscorlib]System.Collections.IEnumerator::get_Current() + IL_0033: stloc.1 + IL_0034: ldstr "current: " + IL_0039: ldloc.1 + IL_003a: call string [mscorlib]System.String::Concat(object, + object) + IL_003f: call void [mscorlib]System.Console::WriteLine(string) + IL_0044: nop + IL_0045: nop + IL_0046: nop + IL_0047: leave.s IL_0062 + + } // end .try + finally + { + IL_0049: nop + IL_004a: ldloc.0 + IL_004b: isinst [mscorlib]System.IDisposable + IL_0050: stloc.2 + IL_0051: ldloc.2 + IL_0052: ldnull + IL_0053: ceq + IL_0055: stloc.3 + IL_0056: ldloc.3 + IL_0057: brtrue.s IL_0060 + + IL_0059: ldloc.2 + IL_005a: callvirt instance void [mscorlib]System.IDisposable::Dispose() + IL_005f: nop + IL_0060: nop + IL_0061: endfinally + } // end handler + IL_0062: nop + IL_0063: ldstr "After finally!" + IL_0068: call void [mscorlib]System.Console::WriteLine(string) + IL_006d: nop + IL_006e: ret + } // end of method Loops::NonGenericForeachWithReturnFallbackTest + + .method public hidebysig static void ForeachWithRefUsage(class [mscorlib]System.Collections.Generic.List`1 items) cil managed + { + // Code size 61 (0x3d) + .maxstack 1 + .locals init (int32 V_0, + int32 V_1, + valuetype [mscorlib]System.Collections.Generic.List`1/Enumerator V_2, + bool V_3) + IL_0000: nop + IL_0001: nop + IL_0002: ldarg.0 + IL_0003: callvirt instance valuetype [mscorlib]System.Collections.Generic.List`1/Enumerator class [mscorlib]System.Collections.Generic.List`1::GetEnumerator() + IL_0008: stloc.2 + .try + { + IL_0009: br.s IL_001f + + IL_000b: ldloca.s V_2 + 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: stloc.1 + IL_0016: ldloca.s V_1 + IL_0018: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops::Operation(int32&) + IL_001d: nop + IL_001e: nop + IL_001f: ldloca.s V_2 + IL_0021: call instance bool valuetype [mscorlib]System.Collections.Generic.List`1/Enumerator::MoveNext() + IL_0026: stloc.3 + IL_0027: ldloc.3 + IL_0028: brtrue.s IL_000b + + IL_002a: leave.s IL_003b + + } // end .try + finally + { + IL_002c: ldloca.s V_2 + IL_002e: constrained. valuetype [mscorlib]System.Collections.Generic.List`1/Enumerator + IL_0034: callvirt instance void [mscorlib]System.IDisposable::Dispose() + IL_0039: nop + IL_003a: endfinally + } // end handler + IL_003b: nop + IL_003c: ret + } // end of method Loops::ForeachWithRefUsage + .method public hidebysig instance void ForOverArray(string[] 'array') cil managed { @@ -594,142 +1579,6 @@ IL_009f: ret } // end of method Loops::ForLoop - .method public hidebysig static void ForeachExceptForContinuedUse(class [mscorlib]System.Collections.Generic.IEnumerable`1 inputs) cil managed - { - // Code size 93 (0x5d) - .maxstack 2 - .locals init (int32 V_0, - class [mscorlib]System.Collections.Generic.IEnumerator`1 V_1, - bool V_2) - IL_0000: nop - IL_0001: ldstr "ForeachExceptForContinuedUse" - IL_0006: call void [mscorlib]System.Console::WriteLine(string) - IL_000b: nop - IL_000c: ldc.i4.0 - IL_000d: stloc.0 - IL_000e: ldarg.0 - IL_000f: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerator`1 class [mscorlib]System.Collections.Generic.IEnumerable`1::GetEnumerator() - IL_0014: stloc.1 - .try - { - IL_0015: nop - IL_0016: br.s IL_0028 - - IL_0018: nop - IL_0019: ldloc.1 - IL_001a: callvirt instance !0 class [mscorlib]System.Collections.Generic.IEnumerator`1::get_Current() - IL_001f: stloc.0 - IL_0020: ldloc.0 - IL_0021: call void [mscorlib]System.Console::WriteLine(int32) - IL_0026: nop - IL_0027: nop - IL_0028: ldloc.1 - IL_0029: callvirt instance bool [mscorlib]System.Collections.IEnumerator::MoveNext() - IL_002e: stloc.2 - IL_002f: ldloc.2 - IL_0030: brtrue.s IL_0018 - - IL_0032: nop - IL_0033: leave.s IL_0045 - - } // end .try - finally - { - IL_0035: ldloc.1 - IL_0036: ldnull - IL_0037: ceq - IL_0039: stloc.2 - IL_003a: ldloc.2 - IL_003b: brtrue.s IL_0044 - - IL_003d: ldloc.1 - IL_003e: callvirt instance void [mscorlib]System.IDisposable::Dispose() - IL_0043: nop - IL_0044: endfinally - } // end handler - IL_0045: nop - IL_0046: ldstr "Last: " - IL_004b: ldloc.0 - IL_004c: box [mscorlib]System.Int32 - IL_0051: call string [mscorlib]System.String::Concat(object, - object) - IL_0056: call void [mscorlib]System.Console::WriteLine(string) - IL_005b: nop - IL_005c: ret - } // end of method Loops::ForeachExceptForContinuedUse - - .method public hidebysig static void NonGenericForeachWithReturnFallbackTest(class [mscorlib]System.Collections.IEnumerable e) cil managed - { - // Code size 113 (0x71) - .maxstack 2 - .locals init (class [mscorlib]System.Collections.IEnumerator V_0, - object V_1, - class [mscorlib]System.IDisposable V_2, - bool V_3) - IL_0000: nop - IL_0001: ldstr "NonGenericForeachWithReturnFallback:" - IL_0006: call void [mscorlib]System.Console::WriteLine(string) - IL_000b: nop - IL_000c: ldarg.0 - IL_000d: callvirt instance class [mscorlib]System.Collections.IEnumerator [mscorlib]System.Collections.IEnumerable::GetEnumerator() - IL_0012: stloc.0 - .try - { - IL_0013: nop - IL_0014: ldstr "MoveNext" - IL_0019: call void [mscorlib]System.Console::WriteLine(string) - IL_001e: nop - IL_001f: ldloc.0 - IL_0020: callvirt instance bool [mscorlib]System.Collections.IEnumerator::MoveNext() - IL_0025: ldc.i4.0 - IL_0026: ceq - IL_0028: stloc.3 - IL_0029: ldloc.3 - IL_002a: brtrue.s IL_0046 - - IL_002c: nop - IL_002d: ldloc.0 - IL_002e: callvirt instance object [mscorlib]System.Collections.IEnumerator::get_Current() - IL_0033: stloc.1 - IL_0034: ldstr "current: " - IL_0039: ldloc.1 - IL_003a: call string [mscorlib]System.String::Concat(object, - object) - IL_003f: call void [mscorlib]System.Console::WriteLine(string) - IL_0044: nop - IL_0045: nop - IL_0046: nop - IL_0047: leave.s IL_0064 - - } // end .try - finally - { - IL_0049: nop - IL_004a: ldloc.0 - IL_004b: isinst [mscorlib]System.IDisposable - IL_0050: stloc.2 - IL_0051: ldloc.2 - IL_0052: ldnull - IL_0053: ceq - IL_0055: stloc.3 - IL_0056: ldloc.3 - IL_0057: brtrue.s IL_0062 - - IL_0059: nop - IL_005a: ldloc.2 - IL_005b: callvirt instance void [mscorlib]System.IDisposable::Dispose() - IL_0060: nop - IL_0061: nop - IL_0062: nop - IL_0063: endfinally - } // end handler - IL_0064: nop - IL_0065: ldstr "After finally!" - IL_006a: call void [mscorlib]System.Console::WriteLine(string) - IL_006f: nop - IL_0070: ret - } // end of method Loops::NonGenericForeachWithReturnFallbackTest - .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { diff --git a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/Loops.opt.il b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/Loops.opt.il index 01bc47850..cac23f532 100644 --- a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/Loops.opt.il +++ b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/Loops.opt.il @@ -10,7 +10,7 @@ .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4.. .ver 4:0:0:0 } -.assembly ukcebu5a +.assembly gqwlhkac { .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 ukcebu5a.dll -// MVID: {D6A0A420-9828-48A7-BAA6-F0BAFB50052B} +.module gqwlhkac.dll +// MVID: {C686C014-E24C-4F11-8C65-376BF4FB1D57} .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: 0x02F50000 +// Image base: 0x029F0000 // =============== CLASS MEMBERS DECLARATION =================== @@ -36,6 +36,483 @@ .class public auto ansi beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops extends [mscorlib]System.Object { + .class auto ansi nested public beforefieldinit CustomClassEnumerator + extends [mscorlib]System.Object + { + .method public hidebysig specialname + instance object get_Current() cil managed + { + // Code size 6 (0x6) + .maxstack 8 + IL_0000: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0005: throw + } // end of method CustomClassEnumerator::get_Current + + .method public hidebysig instance bool + MoveNext() cil managed + { + // Code size 6 (0x6) + .maxstack 8 + IL_0000: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0005: throw + } // end of method CustomClassEnumerator::MoveNext + + .method public hidebysig instance void + Reset() cil managed + { + // Code size 6 (0x6) + .maxstack 8 + IL_0000: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0005: throw + } // end of method CustomClassEnumerator::Reset + + .method public hidebysig instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumerator + GetEnumerator() cil managed + { + // Code size 2 (0x2) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ret + } // end of method CustomClassEnumerator::GetEnumerator + + .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 CustomClassEnumerator::.ctor + + .property instance object Current() + { + .get instance object ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumerator::get_Current() + } // end of property CustomClassEnumerator::Current + } // end of class CustomClassEnumerator + + .class sequential ansi sealed nested public beforefieldinit CustomStructEnumerator + extends [mscorlib]System.ValueType + { + .pack 0 + .size 1 + .method public hidebysig specialname + instance object get_Current() cil managed + { + // Code size 6 (0x6) + .maxstack 8 + IL_0000: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0005: throw + } // end of method CustomStructEnumerator::get_Current + + .method public hidebysig instance bool + MoveNext() cil managed + { + // Code size 6 (0x6) + .maxstack 8 + IL_0000: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0005: throw + } // end of method CustomStructEnumerator::MoveNext + + .method public hidebysig instance void + Reset() cil managed + { + // Code size 6 (0x6) + .maxstack 8 + IL_0000: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0005: throw + } // end of method CustomStructEnumerator::Reset + + .method public hidebysig instance valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumerator + GetEnumerator() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldobj ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumerator + IL_0006: ret + } // end of method CustomStructEnumerator::GetEnumerator + + .property instance object Current() + { + .get instance object ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumerator::get_Current() + } // end of property CustomStructEnumerator::Current + } // end of class CustomStructEnumerator + + .class auto ansi nested public beforefieldinit CustomClassEnumerator`1 + extends [mscorlib]System.Object + { + .method public hidebysig specialname + instance !T get_Current() cil managed + { + // Code size 6 (0x6) + .maxstack 8 + IL_0000: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0005: throw + } // end of method CustomClassEnumerator`1::get_Current + + .method public hidebysig instance void + Dispose() cil managed + { + // Code size 6 (0x6) + .maxstack 8 + IL_0000: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0005: throw + } // end of method CustomClassEnumerator`1::Dispose + + .method public hidebysig instance bool + MoveNext() cil managed + { + // Code size 6 (0x6) + .maxstack 8 + IL_0000: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0005: throw + } // end of method CustomClassEnumerator`1::MoveNext + + .method public hidebysig instance void + Reset() cil managed + { + // Code size 6 (0x6) + .maxstack 8 + IL_0000: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0005: throw + } // end of method CustomClassEnumerator`1::Reset + + .method public hidebysig instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumerator`1 + GetEnumerator() cil managed + { + // Code size 2 (0x2) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ret + } // end of method CustomClassEnumerator`1::GetEnumerator + + .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 CustomClassEnumerator`1::.ctor + + .property instance !T Current() + { + .get instance !T ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumerator`1::get_Current() + } // end of property CustomClassEnumerator`1::Current + } // end of class CustomClassEnumerator`1 + + .class sequential ansi sealed nested public beforefieldinit CustomStructEnumerator`1 + extends [mscorlib]System.ValueType + { + .pack 0 + .size 1 + .method public hidebysig specialname + instance !T get_Current() cil managed + { + // Code size 6 (0x6) + .maxstack 8 + IL_0000: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0005: throw + } // end of method CustomStructEnumerator`1::get_Current + + .method public hidebysig instance void + Dispose() cil managed + { + // Code size 6 (0x6) + .maxstack 8 + IL_0000: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0005: throw + } // end of method CustomStructEnumerator`1::Dispose + + .method public hidebysig instance bool + MoveNext() cil managed + { + // Code size 6 (0x6) + .maxstack 8 + IL_0000: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0005: throw + } // end of method CustomStructEnumerator`1::MoveNext + + .method public hidebysig instance void + Reset() cil managed + { + // Code size 6 (0x6) + .maxstack 8 + IL_0000: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0005: throw + } // end of method CustomStructEnumerator`1::Reset + + .method public hidebysig instance valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumerator`1 + GetEnumerator() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldobj valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumerator`1 + IL_0006: ret + } // end of method CustomStructEnumerator`1::GetEnumerator + + .property instance !T Current() + { + .get instance !T ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumerator`1::get_Current() + } // end of property CustomStructEnumerator`1::Current + } // end of class CustomStructEnumerator`1 + + .class auto ansi nested public beforefieldinit CustomClassEnumeratorWithIDisposable + extends [mscorlib]System.Object + implements [mscorlib]System.IDisposable + { + .method public hidebysig specialname + instance object get_Current() cil managed + { + // Code size 6 (0x6) + .maxstack 8 + IL_0000: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0005: throw + } // end of method CustomClassEnumeratorWithIDisposable::get_Current + + .method public hidebysig newslot virtual final + instance void Dispose() cil managed + { + // Code size 6 (0x6) + .maxstack 8 + IL_0000: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0005: throw + } // end of method CustomClassEnumeratorWithIDisposable::Dispose + + .method public hidebysig instance bool + MoveNext() cil managed + { + // Code size 6 (0x6) + .maxstack 8 + IL_0000: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0005: throw + } // end of method CustomClassEnumeratorWithIDisposable::MoveNext + + .method public hidebysig instance void + Reset() cil managed + { + // Code size 6 (0x6) + .maxstack 8 + IL_0000: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0005: throw + } // end of method CustomClassEnumeratorWithIDisposable::Reset + + .method public hidebysig instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumeratorWithIDisposable + GetEnumerator() cil managed + { + // Code size 2 (0x2) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ret + } // end of method CustomClassEnumeratorWithIDisposable::GetEnumerator + + .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 CustomClassEnumeratorWithIDisposable::.ctor + + .property instance object Current() + { + .get instance object ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumeratorWithIDisposable::get_Current() + } // end of property CustomClassEnumeratorWithIDisposable::Current + } // end of class CustomClassEnumeratorWithIDisposable + + .class sequential ansi sealed nested public beforefieldinit CustomStructEnumeratorWithIDisposable + extends [mscorlib]System.ValueType + implements [mscorlib]System.IDisposable + { + .pack 0 + .size 1 + .method public hidebysig specialname + instance object get_Current() cil managed + { + // Code size 6 (0x6) + .maxstack 8 + IL_0000: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0005: throw + } // end of method CustomStructEnumeratorWithIDisposable::get_Current + + .method public hidebysig newslot virtual final + instance void Dispose() cil managed + { + // Code size 6 (0x6) + .maxstack 8 + IL_0000: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0005: throw + } // end of method CustomStructEnumeratorWithIDisposable::Dispose + + .method public hidebysig instance bool + MoveNext() cil managed + { + // Code size 6 (0x6) + .maxstack 8 + IL_0000: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0005: throw + } // end of method CustomStructEnumeratorWithIDisposable::MoveNext + + .method public hidebysig instance void + Reset() cil managed + { + // Code size 6 (0x6) + .maxstack 8 + IL_0000: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0005: throw + } // end of method CustomStructEnumeratorWithIDisposable::Reset + + .method public hidebysig instance valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable + GetEnumerator() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldobj ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable + IL_0006: ret + } // end of method CustomStructEnumeratorWithIDisposable::GetEnumerator + + .property instance object Current() + { + .get instance object ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable::get_Current() + } // end of property CustomStructEnumeratorWithIDisposable::Current + } // end of class CustomStructEnumeratorWithIDisposable + + .class auto ansi nested public beforefieldinit CustomClassEnumeratorWithIDisposable`1 + extends [mscorlib]System.Object + implements [mscorlib]System.IDisposable + { + .method public hidebysig specialname + instance !T get_Current() cil managed + { + // Code size 6 (0x6) + .maxstack 8 + IL_0000: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0005: throw + } // end of method CustomClassEnumeratorWithIDisposable`1::get_Current + + .method public hidebysig newslot virtual final + instance void Dispose() cil managed + { + // Code size 6 (0x6) + .maxstack 8 + IL_0000: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0005: throw + } // end of method CustomClassEnumeratorWithIDisposable`1::Dispose + + .method public hidebysig instance bool + MoveNext() cil managed + { + // Code size 6 (0x6) + .maxstack 8 + IL_0000: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0005: throw + } // end of method CustomClassEnumeratorWithIDisposable`1::MoveNext + + .method public hidebysig instance void + Reset() cil managed + { + // Code size 6 (0x6) + .maxstack 8 + IL_0000: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0005: throw + } // end of method CustomClassEnumeratorWithIDisposable`1::Reset + + .method public hidebysig instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumeratorWithIDisposable`1 + GetEnumerator() cil managed + { + // Code size 2 (0x2) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ret + } // end of method CustomClassEnumeratorWithIDisposable`1::GetEnumerator + + .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 CustomClassEnumeratorWithIDisposable`1::.ctor + + .property instance !T Current() + { + .get instance !T ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumeratorWithIDisposable`1::get_Current() + } // end of property CustomClassEnumeratorWithIDisposable`1::Current + } // end of class CustomClassEnumeratorWithIDisposable`1 + + .class sequential ansi sealed nested public beforefieldinit CustomStructEnumeratorWithIDisposable`1 + extends [mscorlib]System.ValueType + implements [mscorlib]System.IDisposable + { + .pack 0 + .size 1 + .method public hidebysig specialname + instance !T get_Current() cil managed + { + // Code size 6 (0x6) + .maxstack 8 + IL_0000: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0005: throw + } // end of method CustomStructEnumeratorWithIDisposable`1::get_Current + + .method public hidebysig newslot virtual final + instance void Dispose() cil managed + { + // Code size 6 (0x6) + .maxstack 8 + IL_0000: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0005: throw + } // end of method CustomStructEnumeratorWithIDisposable`1::Dispose + + .method public hidebysig instance bool + MoveNext() cil managed + { + // Code size 6 (0x6) + .maxstack 8 + IL_0000: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0005: throw + } // end of method CustomStructEnumeratorWithIDisposable`1::MoveNext + + .method public hidebysig instance void + Reset() cil managed + { + // Code size 6 (0x6) + .maxstack 8 + IL_0000: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0005: throw + } // end of method CustomStructEnumeratorWithIDisposable`1::Reset + + .method public hidebysig instance valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable`1 + GetEnumerator() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldobj valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable`1 + IL_0006: ret + } // end of method CustomStructEnumeratorWithIDisposable`1::GetEnumerator + + .property instance !T Current() + { + .get instance !T ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable`1::get_Current() + } // end of property CustomStructEnumeratorWithIDisposable`1::Current + } // end of class CustomStructEnumeratorWithIDisposable`1 + + .method private hidebysig static void Operation(int32& item) cil managed + { + // Code size 1 (0x1) + .maxstack 8 + IL_0000: ret + } // end of method Loops::Operation + .method public hidebysig instance void ForEach(class [mscorlib]System.Collections.Generic.IEnumerable`1 enumerable) cil managed { @@ -242,6 +719,327 @@ IL_0036: ret } // end of method Loops::ForEachOverNonGenericEnumerableWithAutomaticCastRefType + .method public hidebysig instance void + ForEachOnCustomClassEnumerator(class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumerator e) cil managed + { + // Code size 50 (0x32) + .maxstack 1 + .locals init (object V_0, + class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumerator V_1, + class [mscorlib]System.IDisposable V_2) + IL_0000: ldarg.1 + IL_0001: callvirt instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumerator ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumerator::GetEnumerator() + IL_0006: stloc.1 + .try + { + IL_0007: br.s IL_0016 + + IL_0009: ldloc.1 + IL_000a: callvirt instance object ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumerator::get_Current() + IL_000f: stloc.0 + IL_0010: ldloc.0 + IL_0011: call void [mscorlib]System.Console::WriteLine(object) + IL_0016: ldloc.1 + IL_0017: callvirt instance bool ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumerator::MoveNext() + IL_001c: brtrue.s IL_0009 + + IL_001e: leave.s IL_0031 + + } // end .try + finally + { + IL_0020: ldloc.1 + IL_0021: isinst [mscorlib]System.IDisposable + IL_0026: stloc.2 + IL_0027: ldloc.2 + IL_0028: brfalse.s IL_0030 + + IL_002a: ldloc.2 + IL_002b: callvirt instance void [mscorlib]System.IDisposable::Dispose() + IL_0030: endfinally + } // end handler + IL_0031: ret + } // end of method Loops::ForEachOnCustomClassEnumerator + + .method public hidebysig instance void + ForEachOnGenericCustomClassEnumerator(class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumerator`1 e) cil managed + { + // Code size 55 (0x37) + .maxstack 1 + .locals init (!!T V_0, + class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumerator`1 V_1, + class [mscorlib]System.IDisposable V_2) + IL_0000: ldarg.1 + IL_0001: callvirt instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumerator`1 class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumerator`1::GetEnumerator() + IL_0006: stloc.1 + .try + { + IL_0007: br.s IL_001b + + IL_0009: ldloc.1 + IL_000a: callvirt instance !0 class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumerator`1::get_Current() + IL_000f: stloc.0 + IL_0010: ldloc.0 + IL_0011: box !!T + IL_0016: call void [mscorlib]System.Console::WriteLine(object) + IL_001b: ldloc.1 + IL_001c: callvirt instance bool class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumerator`1::MoveNext() + IL_0021: brtrue.s IL_0009 + + IL_0023: leave.s IL_0036 + + } // end .try + finally + { + IL_0025: ldloc.1 + IL_0026: isinst [mscorlib]System.IDisposable + IL_002b: stloc.2 + IL_002c: ldloc.2 + IL_002d: brfalse.s IL_0035 + + IL_002f: ldloc.2 + IL_0030: callvirt instance void [mscorlib]System.IDisposable::Dispose() + IL_0035: endfinally + } // end handler + IL_0036: ret + } // end of method Loops::ForEachOnGenericCustomClassEnumerator + + .method public hidebysig instance void + ForEachOnCustomClassEnumeratorWithIDisposable(class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumeratorWithIDisposable e) cil managed + { + // Code size 43 (0x2b) + .maxstack 1 + .locals init (object V_0, + class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumeratorWithIDisposable V_1) + IL_0000: ldarg.1 + IL_0001: callvirt instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumeratorWithIDisposable ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumeratorWithIDisposable::GetEnumerator() + IL_0006: stloc.1 + .try + { + IL_0007: br.s IL_0016 + + IL_0009: ldloc.1 + IL_000a: callvirt instance object ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumeratorWithIDisposable::get_Current() + IL_000f: stloc.0 + IL_0010: ldloc.0 + IL_0011: call void [mscorlib]System.Console::WriteLine(object) + IL_0016: ldloc.1 + IL_0017: callvirt instance bool ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumeratorWithIDisposable::MoveNext() + IL_001c: brtrue.s IL_0009 + + IL_001e: leave.s IL_002a + + } // end .try + finally + { + IL_0020: ldloc.1 + IL_0021: brfalse.s IL_0029 + + IL_0023: ldloc.1 + IL_0024: callvirt instance void [mscorlib]System.IDisposable::Dispose() + IL_0029: endfinally + } // end handler + IL_002a: ret + } // end of method Loops::ForEachOnCustomClassEnumeratorWithIDisposable + + .method public hidebysig instance void + ForEachOnCustomStructEnumeratorWithIDisposable(valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable e) cil managed + { + // Code size 50 (0x32) + .maxstack 1 + .locals init (object V_0, + valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable V_1) + IL_0000: ldarga.s e + IL_0002: call instance valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable::GetEnumerator() + IL_0007: stloc.1 + .try + { + IL_0008: br.s IL_0018 + + IL_000a: ldloca.s V_1 + IL_000c: call instance object ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable::get_Current() + IL_0011: stloc.0 + IL_0012: ldloc.0 + IL_0013: call void [mscorlib]System.Console::WriteLine(object) + IL_0018: ldloca.s V_1 + IL_001a: call instance bool ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable::MoveNext() + IL_001f: brtrue.s IL_000a + + IL_0021: leave.s IL_0031 + + } // end .try + finally + { + IL_0023: ldloca.s V_1 + IL_0025: constrained. ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable + IL_002b: callvirt instance void [mscorlib]System.IDisposable::Dispose() + IL_0030: endfinally + } // end handler + IL_0031: ret + } // end of method Loops::ForEachOnCustomStructEnumeratorWithIDisposable + + .method public hidebysig instance void + ForEachOnGenericCustomClassEnumeratorWithIDisposable(class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumeratorWithIDisposable`1 e) cil managed + { + // Code size 48 (0x30) + .maxstack 1 + .locals init (!!T V_0, + class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumeratorWithIDisposable`1 V_1) + IL_0000: ldarg.1 + IL_0001: callvirt instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumeratorWithIDisposable`1 class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumeratorWithIDisposable`1::GetEnumerator() + IL_0006: stloc.1 + .try + { + IL_0007: br.s IL_001b + + IL_0009: ldloc.1 + IL_000a: callvirt instance !0 class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumeratorWithIDisposable`1::get_Current() + IL_000f: stloc.0 + IL_0010: ldloc.0 + IL_0011: box !!T + IL_0016: call void [mscorlib]System.Console::WriteLine(object) + IL_001b: ldloc.1 + IL_001c: callvirt instance bool class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumeratorWithIDisposable`1::MoveNext() + IL_0021: brtrue.s IL_0009 + + IL_0023: leave.s IL_002f + + } // end .try + finally + { + IL_0025: ldloc.1 + IL_0026: brfalse.s IL_002e + + IL_0028: ldloc.1 + IL_0029: callvirt instance void [mscorlib]System.IDisposable::Dispose() + IL_002e: endfinally + } // end handler + IL_002f: ret + } // end of method Loops::ForEachOnGenericCustomClassEnumeratorWithIDisposable + + .method public hidebysig instance void + ForEachOnGenericCustomStructEnumeratorWithIDisposable(valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable`1 e) cil managed + { + // Code size 55 (0x37) + .maxstack 1 + .locals init (!!T V_0, + valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable`1 V_1) + IL_0000: ldarga.s e + IL_0002: call instance valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable`1 valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable`1::GetEnumerator() + IL_0007: stloc.1 + .try + { + IL_0008: br.s IL_001d + + IL_000a: ldloca.s V_1 + IL_000c: call instance !0 valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable`1::get_Current() + IL_0011: stloc.0 + IL_0012: ldloc.0 + IL_0013: box !!T + IL_0018: call void [mscorlib]System.Console::WriteLine(object) + IL_001d: ldloca.s V_1 + IL_001f: call instance bool valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable`1::MoveNext() + IL_0024: brtrue.s IL_000a + + IL_0026: leave.s IL_0036 + + } // end .try + finally + { + IL_0028: ldloca.s V_1 + IL_002a: constrained. valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable`1 + IL_0030: callvirt instance void [mscorlib]System.IDisposable::Dispose() + IL_0035: endfinally + } // end handler + IL_0036: ret + } // end of method Loops::ForEachOnGenericCustomStructEnumeratorWithIDisposable + + .method public hidebysig static void NonGenericForeachWithReturnFallbackTest(class [mscorlib]System.Collections.IEnumerable e) cil managed + { + // Code size 88 (0x58) + .maxstack 2 + .locals init (class [mscorlib]System.Collections.IEnumerator V_0, + object V_1, + class [mscorlib]System.IDisposable V_2) + IL_0000: ldstr "NonGenericForeachWithReturnFallback:" + IL_0005: call void [mscorlib]System.Console::WriteLine(string) + IL_000a: ldarg.0 + IL_000b: callvirt instance class [mscorlib]System.Collections.IEnumerator [mscorlib]System.Collections.IEnumerable::GetEnumerator() + IL_0010: stloc.0 + .try + { + IL_0011: ldstr "MoveNext" + IL_0016: call void [mscorlib]System.Console::WriteLine(string) + IL_001b: ldloc.0 + IL_001c: callvirt instance bool [mscorlib]System.Collections.IEnumerator::MoveNext() + IL_0021: brfalse.s IL_003a + + IL_0023: ldloc.0 + IL_0024: callvirt instance object [mscorlib]System.Collections.IEnumerator::get_Current() + IL_0029: stloc.1 + IL_002a: ldstr "current: " + IL_002f: ldloc.1 + IL_0030: call string [mscorlib]System.String::Concat(object, + object) + IL_0035: call void [mscorlib]System.Console::WriteLine(string) + IL_003a: leave.s IL_004d + + } // end .try + finally + { + IL_003c: ldloc.0 + IL_003d: isinst [mscorlib]System.IDisposable + IL_0042: stloc.2 + IL_0043: ldloc.2 + IL_0044: brfalse.s IL_004c + + IL_0046: ldloc.2 + IL_0047: callvirt instance void [mscorlib]System.IDisposable::Dispose() + IL_004c: endfinally + } // end handler + IL_004d: ldstr "After finally!" + IL_0052: call void [mscorlib]System.Console::WriteLine(string) + IL_0057: ret + } // end of method Loops::NonGenericForeachWithReturnFallbackTest + + .method public hidebysig static void ForeachWithRefUsage(class [mscorlib]System.Collections.Generic.List`1 items) cil managed + { + // Code size 52 (0x34) + .maxstack 1 + .locals init (int32 V_0, + int32 V_1, + valuetype [mscorlib]System.Collections.Generic.List`1/Enumerator V_2) + IL_0000: ldarg.0 + IL_0001: callvirt instance valuetype [mscorlib]System.Collections.Generic.List`1/Enumerator class [mscorlib]System.Collections.Generic.List`1::GetEnumerator() + IL_0006: stloc.2 + .try + { + IL_0007: br.s IL_001a + + IL_0009: ldloca.s V_2 + 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: stloc.1 + IL_0013: ldloca.s V_1 + IL_0015: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops::Operation(int32&) + IL_001a: ldloca.s V_2 + IL_001c: call instance bool valuetype [mscorlib]System.Collections.Generic.List`1/Enumerator::MoveNext() + IL_0021: brtrue.s IL_0009 + + IL_0023: leave.s IL_0033 + + } // end .try + finally + { + IL_0025: ldloca.s V_2 + IL_0027: constrained. valuetype [mscorlib]System.Collections.Generic.List`1/Enumerator + IL_002d: callvirt instance void [mscorlib]System.IDisposable::Dispose() + IL_0032: endfinally + } // end handler + IL_0033: ret + } // end of method Loops::ForeachWithRefUsage + .method public hidebysig instance void ForOverArray(string[] 'array') cil managed { @@ -426,101 +1224,6 @@ IL_007b: ret } // end of method Loops::ForLoop - .method public hidebysig static void ForeachExceptForContinuedUse(class [mscorlib]System.Collections.Generic.IEnumerable`1 inputs) cil managed - { - // Code size 76 (0x4c) - .maxstack 2 - .locals init (int32 V_0, - class [mscorlib]System.Collections.Generic.IEnumerator`1 V_1) - IL_0000: ldstr "ForeachExceptForContinuedUse" - IL_0005: call void [mscorlib]System.Console::WriteLine(string) - IL_000a: ldc.i4.0 - IL_000b: stloc.0 - IL_000c: ldarg.0 - IL_000d: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerator`1 class [mscorlib]System.Collections.Generic.IEnumerable`1::GetEnumerator() - IL_0012: stloc.1 - .try - { - IL_0013: br.s IL_0022 - - IL_0015: ldloc.1 - IL_0016: callvirt instance !0 class [mscorlib]System.Collections.Generic.IEnumerator`1::get_Current() - IL_001b: stloc.0 - IL_001c: ldloc.0 - IL_001d: call void [mscorlib]System.Console::WriteLine(int32) - IL_0022: ldloc.1 - IL_0023: callvirt instance bool [mscorlib]System.Collections.IEnumerator::MoveNext() - IL_0028: brtrue.s IL_0015 - - IL_002a: leave.s IL_0036 - - } // end .try - finally - { - IL_002c: ldloc.1 - IL_002d: brfalse.s IL_0035 - - IL_002f: ldloc.1 - IL_0030: callvirt instance void [mscorlib]System.IDisposable::Dispose() - IL_0035: endfinally - } // end handler - IL_0036: ldstr "Last: " - IL_003b: ldloc.0 - IL_003c: box [mscorlib]System.Int32 - IL_0041: call string [mscorlib]System.String::Concat(object, - object) - IL_0046: call void [mscorlib]System.Console::WriteLine(string) - IL_004b: ret - } // end of method Loops::ForeachExceptForContinuedUse - - .method public hidebysig static void NonGenericForeachWithReturnFallbackTest(class [mscorlib]System.Collections.IEnumerable e) cil managed - { - // Code size 88 (0x58) - .maxstack 2 - .locals init (class [mscorlib]System.Collections.IEnumerator V_0, - object V_1, - class [mscorlib]System.IDisposable V_2) - IL_0000: ldstr "NonGenericForeachWithReturnFallback:" - IL_0005: call void [mscorlib]System.Console::WriteLine(string) - IL_000a: ldarg.0 - IL_000b: callvirt instance class [mscorlib]System.Collections.IEnumerator [mscorlib]System.Collections.IEnumerable::GetEnumerator() - IL_0010: stloc.0 - .try - { - IL_0011: ldstr "MoveNext" - IL_0016: call void [mscorlib]System.Console::WriteLine(string) - IL_001b: ldloc.0 - IL_001c: callvirt instance bool [mscorlib]System.Collections.IEnumerator::MoveNext() - IL_0021: brfalse.s IL_003a - - IL_0023: ldloc.0 - IL_0024: callvirt instance object [mscorlib]System.Collections.IEnumerator::get_Current() - IL_0029: stloc.1 - IL_002a: ldstr "current: " - IL_002f: ldloc.1 - IL_0030: call string [mscorlib]System.String::Concat(object, - object) - IL_0035: call void [mscorlib]System.Console::WriteLine(string) - IL_003a: leave.s IL_004d - - } // end .try - finally - { - IL_003c: ldloc.0 - IL_003d: isinst [mscorlib]System.IDisposable - IL_0042: stloc.2 - IL_0043: ldloc.2 - IL_0044: brfalse.s IL_004c - - IL_0046: ldloc.2 - IL_0047: callvirt instance void [mscorlib]System.IDisposable::Dispose() - IL_004c: endfinally - } // end handler - IL_004d: ldstr "After finally!" - IL_0052: call void [mscorlib]System.Console::WriteLine(string) - IL_0057: ret - } // end of method Loops::NonGenericForeachWithReturnFallbackTest - .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { diff --git a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/Loops.opt.roslyn.il b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/Loops.opt.roslyn.il index 4f67a29b3..fb0b1e4e4 100644 --- a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/Loops.opt.roslyn.il +++ b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/Loops.opt.roslyn.il @@ -25,14 +25,14 @@ .ver 0:0:0:0 } .module Loops.dll -// MVID: {7BFC079C-5BB9-4A1A-A6EB-BA407AB11CEF} +// MVID: {D4B3ED88-9C2E-4892-ADBB-4383F95FBA96} .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: 0x011F0000 +// Image base: 0x024C0000 // =============== CLASS MEMBERS DECLARATION =================== @@ -40,6 +40,483 @@ .class public auto ansi beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops extends [mscorlib]System.Object { + .class auto ansi nested public beforefieldinit CustomClassEnumerator + extends [mscorlib]System.Object + { + .method public hidebysig specialname + instance object get_Current() cil managed + { + // Code size 6 (0x6) + .maxstack 8 + IL_0000: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0005: throw + } // end of method CustomClassEnumerator::get_Current + + .method public hidebysig instance bool + MoveNext() cil managed + { + // Code size 6 (0x6) + .maxstack 8 + IL_0000: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0005: throw + } // end of method CustomClassEnumerator::MoveNext + + .method public hidebysig instance void + Reset() cil managed + { + // Code size 6 (0x6) + .maxstack 8 + IL_0000: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0005: throw + } // end of method CustomClassEnumerator::Reset + + .method public hidebysig instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumerator + GetEnumerator() cil managed + { + // Code size 2 (0x2) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ret + } // end of method CustomClassEnumerator::GetEnumerator + + .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 CustomClassEnumerator::.ctor + + .property instance object Current() + { + .get instance object ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumerator::get_Current() + } // end of property CustomClassEnumerator::Current + } // end of class CustomClassEnumerator + + .class sequential ansi sealed nested public beforefieldinit CustomStructEnumerator + extends [mscorlib]System.ValueType + { + .pack 0 + .size 1 + .method public hidebysig specialname + instance object get_Current() cil managed + { + // Code size 6 (0x6) + .maxstack 8 + IL_0000: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0005: throw + } // end of method CustomStructEnumerator::get_Current + + .method public hidebysig instance bool + MoveNext() cil managed + { + // Code size 6 (0x6) + .maxstack 8 + IL_0000: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0005: throw + } // end of method CustomStructEnumerator::MoveNext + + .method public hidebysig instance void + Reset() cil managed + { + // Code size 6 (0x6) + .maxstack 8 + IL_0000: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0005: throw + } // end of method CustomStructEnumerator::Reset + + .method public hidebysig instance valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumerator + GetEnumerator() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldobj ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumerator + IL_0006: ret + } // end of method CustomStructEnumerator::GetEnumerator + + .property instance object Current() + { + .get instance object ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumerator::get_Current() + } // end of property CustomStructEnumerator::Current + } // end of class CustomStructEnumerator + + .class auto ansi nested public beforefieldinit CustomClassEnumerator`1 + extends [mscorlib]System.Object + { + .method public hidebysig specialname + instance !T get_Current() cil managed + { + // Code size 6 (0x6) + .maxstack 8 + IL_0000: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0005: throw + } // end of method CustomClassEnumerator`1::get_Current + + .method public hidebysig instance void + Dispose() cil managed + { + // Code size 6 (0x6) + .maxstack 8 + IL_0000: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0005: throw + } // end of method CustomClassEnumerator`1::Dispose + + .method public hidebysig instance bool + MoveNext() cil managed + { + // Code size 6 (0x6) + .maxstack 8 + IL_0000: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0005: throw + } // end of method CustomClassEnumerator`1::MoveNext + + .method public hidebysig instance void + Reset() cil managed + { + // Code size 6 (0x6) + .maxstack 8 + IL_0000: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0005: throw + } // end of method CustomClassEnumerator`1::Reset + + .method public hidebysig instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumerator`1 + GetEnumerator() cil managed + { + // Code size 2 (0x2) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ret + } // end of method CustomClassEnumerator`1::GetEnumerator + + .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 CustomClassEnumerator`1::.ctor + + .property instance !T Current() + { + .get instance !T ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumerator`1::get_Current() + } // end of property CustomClassEnumerator`1::Current + } // end of class CustomClassEnumerator`1 + + .class sequential ansi sealed nested public beforefieldinit CustomStructEnumerator`1 + extends [mscorlib]System.ValueType + { + .pack 0 + .size 1 + .method public hidebysig specialname + instance !T get_Current() cil managed + { + // Code size 6 (0x6) + .maxstack 8 + IL_0000: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0005: throw + } // end of method CustomStructEnumerator`1::get_Current + + .method public hidebysig instance void + Dispose() cil managed + { + // Code size 6 (0x6) + .maxstack 8 + IL_0000: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0005: throw + } // end of method CustomStructEnumerator`1::Dispose + + .method public hidebysig instance bool + MoveNext() cil managed + { + // Code size 6 (0x6) + .maxstack 8 + IL_0000: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0005: throw + } // end of method CustomStructEnumerator`1::MoveNext + + .method public hidebysig instance void + Reset() cil managed + { + // Code size 6 (0x6) + .maxstack 8 + IL_0000: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0005: throw + } // end of method CustomStructEnumerator`1::Reset + + .method public hidebysig instance valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumerator`1 + GetEnumerator() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldobj valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumerator`1 + IL_0006: ret + } // end of method CustomStructEnumerator`1::GetEnumerator + + .property instance !T Current() + { + .get instance !T ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumerator`1::get_Current() + } // end of property CustomStructEnumerator`1::Current + } // end of class CustomStructEnumerator`1 + + .class auto ansi nested public beforefieldinit CustomClassEnumeratorWithIDisposable + extends [mscorlib]System.Object + implements [mscorlib]System.IDisposable + { + .method public hidebysig specialname + instance object get_Current() cil managed + { + // Code size 6 (0x6) + .maxstack 8 + IL_0000: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0005: throw + } // end of method CustomClassEnumeratorWithIDisposable::get_Current + + .method public hidebysig newslot virtual final + instance void Dispose() cil managed + { + // Code size 6 (0x6) + .maxstack 8 + IL_0000: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0005: throw + } // end of method CustomClassEnumeratorWithIDisposable::Dispose + + .method public hidebysig instance bool + MoveNext() cil managed + { + // Code size 6 (0x6) + .maxstack 8 + IL_0000: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0005: throw + } // end of method CustomClassEnumeratorWithIDisposable::MoveNext + + .method public hidebysig instance void + Reset() cil managed + { + // Code size 6 (0x6) + .maxstack 8 + IL_0000: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0005: throw + } // end of method CustomClassEnumeratorWithIDisposable::Reset + + .method public hidebysig instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumeratorWithIDisposable + GetEnumerator() cil managed + { + // Code size 2 (0x2) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ret + } // end of method CustomClassEnumeratorWithIDisposable::GetEnumerator + + .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 CustomClassEnumeratorWithIDisposable::.ctor + + .property instance object Current() + { + .get instance object ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumeratorWithIDisposable::get_Current() + } // end of property CustomClassEnumeratorWithIDisposable::Current + } // end of class CustomClassEnumeratorWithIDisposable + + .class sequential ansi sealed nested public beforefieldinit CustomStructEnumeratorWithIDisposable + extends [mscorlib]System.ValueType + implements [mscorlib]System.IDisposable + { + .pack 0 + .size 1 + .method public hidebysig specialname + instance object get_Current() cil managed + { + // Code size 6 (0x6) + .maxstack 8 + IL_0000: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0005: throw + } // end of method CustomStructEnumeratorWithIDisposable::get_Current + + .method public hidebysig newslot virtual final + instance void Dispose() cil managed + { + // Code size 6 (0x6) + .maxstack 8 + IL_0000: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0005: throw + } // end of method CustomStructEnumeratorWithIDisposable::Dispose + + .method public hidebysig instance bool + MoveNext() cil managed + { + // Code size 6 (0x6) + .maxstack 8 + IL_0000: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0005: throw + } // end of method CustomStructEnumeratorWithIDisposable::MoveNext + + .method public hidebysig instance void + Reset() cil managed + { + // Code size 6 (0x6) + .maxstack 8 + IL_0000: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0005: throw + } // end of method CustomStructEnumeratorWithIDisposable::Reset + + .method public hidebysig instance valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable + GetEnumerator() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldobj ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable + IL_0006: ret + } // end of method CustomStructEnumeratorWithIDisposable::GetEnumerator + + .property instance object Current() + { + .get instance object ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable::get_Current() + } // end of property CustomStructEnumeratorWithIDisposable::Current + } // end of class CustomStructEnumeratorWithIDisposable + + .class auto ansi nested public beforefieldinit CustomClassEnumeratorWithIDisposable`1 + extends [mscorlib]System.Object + implements [mscorlib]System.IDisposable + { + .method public hidebysig specialname + instance !T get_Current() cil managed + { + // Code size 6 (0x6) + .maxstack 8 + IL_0000: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0005: throw + } // end of method CustomClassEnumeratorWithIDisposable`1::get_Current + + .method public hidebysig newslot virtual final + instance void Dispose() cil managed + { + // Code size 6 (0x6) + .maxstack 8 + IL_0000: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0005: throw + } // end of method CustomClassEnumeratorWithIDisposable`1::Dispose + + .method public hidebysig instance bool + MoveNext() cil managed + { + // Code size 6 (0x6) + .maxstack 8 + IL_0000: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0005: throw + } // end of method CustomClassEnumeratorWithIDisposable`1::MoveNext + + .method public hidebysig instance void + Reset() cil managed + { + // Code size 6 (0x6) + .maxstack 8 + IL_0000: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0005: throw + } // end of method CustomClassEnumeratorWithIDisposable`1::Reset + + .method public hidebysig instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumeratorWithIDisposable`1 + GetEnumerator() cil managed + { + // Code size 2 (0x2) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ret + } // end of method CustomClassEnumeratorWithIDisposable`1::GetEnumerator + + .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 CustomClassEnumeratorWithIDisposable`1::.ctor + + .property instance !T Current() + { + .get instance !T ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumeratorWithIDisposable`1::get_Current() + } // end of property CustomClassEnumeratorWithIDisposable`1::Current + } // end of class CustomClassEnumeratorWithIDisposable`1 + + .class sequential ansi sealed nested public beforefieldinit CustomStructEnumeratorWithIDisposable`1 + extends [mscorlib]System.ValueType + implements [mscorlib]System.IDisposable + { + .pack 0 + .size 1 + .method public hidebysig specialname + instance !T get_Current() cil managed + { + // Code size 6 (0x6) + .maxstack 8 + IL_0000: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0005: throw + } // end of method CustomStructEnumeratorWithIDisposable`1::get_Current + + .method public hidebysig newslot virtual final + instance void Dispose() cil managed + { + // Code size 6 (0x6) + .maxstack 8 + IL_0000: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0005: throw + } // end of method CustomStructEnumeratorWithIDisposable`1::Dispose + + .method public hidebysig instance bool + MoveNext() cil managed + { + // Code size 6 (0x6) + .maxstack 8 + IL_0000: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0005: throw + } // end of method CustomStructEnumeratorWithIDisposable`1::MoveNext + + .method public hidebysig instance void + Reset() cil managed + { + // Code size 6 (0x6) + .maxstack 8 + IL_0000: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0005: throw + } // end of method CustomStructEnumeratorWithIDisposable`1::Reset + + .method public hidebysig instance valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable`1 + GetEnumerator() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldobj valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable`1 + IL_0006: ret + } // end of method CustomStructEnumeratorWithIDisposable`1::GetEnumerator + + .property instance !T Current() + { + .get instance !T ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable`1::get_Current() + } // end of property CustomStructEnumeratorWithIDisposable`1::Current + } // end of class CustomStructEnumeratorWithIDisposable`1 + + .method private hidebysig static void Operation(int32& item) cil managed + { + // Code size 1 (0x1) + .maxstack 8 + IL_0000: ret + } // end of method Loops::Operation + .method public hidebysig instance void ForEach(class [mscorlib]System.Collections.Generic.IEnumerable`1 enumerable) cil managed { @@ -234,6 +711,306 @@ IL_0034: ret } // end of method Loops::ForEachOverNonGenericEnumerableWithAutomaticCastRefType + .method public hidebysig instance void + ForEachOnCustomClassEnumerator(class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumerator e) cil managed + { + // Code size 48 (0x30) + .maxstack 1 + .locals init (class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumerator V_0, + class [mscorlib]System.IDisposable V_1) + IL_0000: ldarg.1 + IL_0001: callvirt instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumerator ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumerator::GetEnumerator() + IL_0006: stloc.0 + .try + { + IL_0007: br.s IL_0014 + + IL_0009: ldloc.0 + IL_000a: callvirt instance object ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumerator::get_Current() + IL_000f: call void [mscorlib]System.Console::WriteLine(object) + IL_0014: ldloc.0 + IL_0015: callvirt instance bool ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumerator::MoveNext() + IL_001a: brtrue.s IL_0009 + + IL_001c: leave.s IL_002f + + } // end .try + finally + { + IL_001e: ldloc.0 + IL_001f: isinst [mscorlib]System.IDisposable + IL_0024: stloc.1 + IL_0025: ldloc.1 + IL_0026: brfalse.s IL_002e + + IL_0028: ldloc.1 + IL_0029: callvirt instance void [mscorlib]System.IDisposable::Dispose() + IL_002e: endfinally + } // end handler + IL_002f: ret + } // end of method Loops::ForEachOnCustomClassEnumerator + + .method public hidebysig instance void + ForEachOnGenericCustomClassEnumerator(class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumerator`1 e) cil managed + { + // Code size 53 (0x35) + .maxstack 1 + .locals init (class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumerator`1 V_0, + class [mscorlib]System.IDisposable V_1) + IL_0000: ldarg.1 + IL_0001: callvirt instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumerator`1 class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumerator`1::GetEnumerator() + IL_0006: stloc.0 + .try + { + IL_0007: br.s IL_0019 + + IL_0009: ldloc.0 + IL_000a: callvirt instance !0 class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumerator`1::get_Current() + IL_000f: box !!T + IL_0014: call void [mscorlib]System.Console::WriteLine(object) + IL_0019: ldloc.0 + IL_001a: callvirt instance bool class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumerator`1::MoveNext() + IL_001f: brtrue.s IL_0009 + + IL_0021: leave.s IL_0034 + + } // end .try + finally + { + IL_0023: ldloc.0 + IL_0024: isinst [mscorlib]System.IDisposable + IL_0029: stloc.1 + IL_002a: ldloc.1 + IL_002b: brfalse.s IL_0033 + + IL_002d: ldloc.1 + IL_002e: callvirt instance void [mscorlib]System.IDisposable::Dispose() + IL_0033: endfinally + } // end handler + IL_0034: ret + } // end of method Loops::ForEachOnGenericCustomClassEnumerator + + .method public hidebysig instance void + ForEachOnCustomClassEnumeratorWithIDisposable(class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumeratorWithIDisposable e) cil managed + { + // Code size 41 (0x29) + .maxstack 1 + .locals init (class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumeratorWithIDisposable V_0) + IL_0000: ldarg.1 + IL_0001: callvirt instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumeratorWithIDisposable ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumeratorWithIDisposable::GetEnumerator() + IL_0006: stloc.0 + .try + { + IL_0007: br.s IL_0014 + + IL_0009: ldloc.0 + IL_000a: callvirt instance object ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumeratorWithIDisposable::get_Current() + IL_000f: call void [mscorlib]System.Console::WriteLine(object) + IL_0014: ldloc.0 + IL_0015: callvirt instance bool ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumeratorWithIDisposable::MoveNext() + IL_001a: brtrue.s IL_0009 + + IL_001c: leave.s IL_0028 + + } // end .try + finally + { + IL_001e: ldloc.0 + IL_001f: brfalse.s IL_0027 + + IL_0021: ldloc.0 + IL_0022: callvirt instance void [mscorlib]System.IDisposable::Dispose() + IL_0027: endfinally + } // end handler + IL_0028: ret + } // end of method Loops::ForEachOnCustomClassEnumeratorWithIDisposable + + .method public hidebysig instance void + ForEachOnCustomStructEnumeratorWithIDisposable(valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable e) cil managed + { + // Code size 48 (0x30) + .maxstack 1 + .locals init (valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable V_0) + IL_0000: ldarga.s e + IL_0002: call instance valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable::GetEnumerator() + IL_0007: stloc.0 + .try + { + IL_0008: br.s IL_0016 + + IL_000a: ldloca.s V_0 + IL_000c: call instance object ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable::get_Current() + IL_0011: call void [mscorlib]System.Console::WriteLine(object) + IL_0016: ldloca.s V_0 + IL_0018: call instance bool ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable::MoveNext() + IL_001d: brtrue.s IL_000a + + IL_001f: leave.s IL_002f + + } // end .try + finally + { + IL_0021: ldloca.s V_0 + IL_0023: constrained. ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable + IL_0029: callvirt instance void [mscorlib]System.IDisposable::Dispose() + IL_002e: endfinally + } // end handler + IL_002f: ret + } // end of method Loops::ForEachOnCustomStructEnumeratorWithIDisposable + + .method public hidebysig instance void + ForEachOnGenericCustomClassEnumeratorWithIDisposable(class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumeratorWithIDisposable`1 e) cil managed + { + // Code size 46 (0x2e) + .maxstack 1 + .locals init (class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumeratorWithIDisposable`1 V_0) + IL_0000: ldarg.1 + IL_0001: callvirt instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumeratorWithIDisposable`1 class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumeratorWithIDisposable`1::GetEnumerator() + IL_0006: stloc.0 + .try + { + IL_0007: br.s IL_0019 + + IL_0009: ldloc.0 + IL_000a: callvirt instance !0 class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumeratorWithIDisposable`1::get_Current() + IL_000f: box !!T + IL_0014: call void [mscorlib]System.Console::WriteLine(object) + IL_0019: ldloc.0 + IL_001a: callvirt instance bool class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumeratorWithIDisposable`1::MoveNext() + IL_001f: brtrue.s IL_0009 + + IL_0021: leave.s IL_002d + + } // end .try + finally + { + IL_0023: ldloc.0 + IL_0024: brfalse.s IL_002c + + IL_0026: ldloc.0 + IL_0027: callvirt instance void [mscorlib]System.IDisposable::Dispose() + IL_002c: endfinally + } // end handler + IL_002d: ret + } // end of method Loops::ForEachOnGenericCustomClassEnumeratorWithIDisposable + + .method public hidebysig instance void + ForEachOnGenericCustomStructEnumeratorWithIDisposable(valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable`1 e) cil managed + { + // Code size 53 (0x35) + .maxstack 1 + .locals init (valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable`1 V_0) + IL_0000: ldarga.s e + IL_0002: call instance valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable`1 valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable`1::GetEnumerator() + IL_0007: stloc.0 + .try + { + IL_0008: br.s IL_001b + + IL_000a: ldloca.s V_0 + IL_000c: call instance !0 valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable`1::get_Current() + IL_0011: box !!T + IL_0016: call void [mscorlib]System.Console::WriteLine(object) + IL_001b: ldloca.s V_0 + IL_001d: call instance bool valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable`1::MoveNext() + IL_0022: brtrue.s IL_000a + + IL_0024: leave.s IL_0034 + + } // end .try + finally + { + IL_0026: ldloca.s V_0 + IL_0028: constrained. valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable`1 + IL_002e: callvirt instance void [mscorlib]System.IDisposable::Dispose() + IL_0033: endfinally + } // end handler + IL_0034: ret + } // end of method Loops::ForEachOnGenericCustomStructEnumeratorWithIDisposable + + .method public hidebysig static void NonGenericForeachWithReturnFallbackTest(class [mscorlib]System.Collections.IEnumerable e) cil managed + { + // Code size 88 (0x58) + .maxstack 2 + .locals init (class [mscorlib]System.Collections.IEnumerator V_0, + object V_1, + class [mscorlib]System.IDisposable V_2) + IL_0000: ldstr "NonGenericForeachWithReturnFallback:" + IL_0005: call void [mscorlib]System.Console::WriteLine(string) + IL_000a: ldarg.0 + IL_000b: callvirt instance class [mscorlib]System.Collections.IEnumerator [mscorlib]System.Collections.IEnumerable::GetEnumerator() + IL_0010: stloc.0 + .try + { + IL_0011: ldstr "MoveNext" + IL_0016: call void [mscorlib]System.Console::WriteLine(string) + IL_001b: ldloc.0 + IL_001c: callvirt instance bool [mscorlib]System.Collections.IEnumerator::MoveNext() + IL_0021: brfalse.s IL_003a + + IL_0023: ldloc.0 + IL_0024: callvirt instance object [mscorlib]System.Collections.IEnumerator::get_Current() + IL_0029: stloc.1 + IL_002a: ldstr "current: " + IL_002f: ldloc.1 + IL_0030: call string [mscorlib]System.String::Concat(object, + object) + IL_0035: call void [mscorlib]System.Console::WriteLine(string) + IL_003a: leave.s IL_004d + + } // end .try + finally + { + IL_003c: ldloc.0 + IL_003d: isinst [mscorlib]System.IDisposable + IL_0042: stloc.2 + IL_0043: ldloc.2 + IL_0044: brfalse.s IL_004c + + IL_0046: ldloc.2 + IL_0047: callvirt instance void [mscorlib]System.IDisposable::Dispose() + IL_004c: endfinally + } // end handler + IL_004d: ldstr "After finally!" + IL_0052: call void [mscorlib]System.Console::WriteLine(string) + IL_0057: ret + } // end of method Loops::NonGenericForeachWithReturnFallbackTest + + .method public hidebysig static void ForeachWithRefUsage(class [mscorlib]System.Collections.Generic.List`1 items) cil managed + { + // Code size 50 (0x32) + .maxstack 1 + .locals init (valuetype [mscorlib]System.Collections.Generic.List`1/Enumerator V_0, + int32 V_1) + IL_0000: ldarg.0 + 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_0018 + + IL_0009: ldloca.s V_0 + IL_000b: call instance !0 valuetype [mscorlib]System.Collections.Generic.List`1/Enumerator::get_Current() + IL_0010: stloc.1 + IL_0011: ldloca.s V_1 + IL_0013: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops::Operation(int32&) + IL_0018: ldloca.s V_0 + 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_0 + 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::ForeachWithRefUsage + .method public hidebysig instance void ForOverArray(string[] 'array') cil managed { @@ -418,101 +1195,6 @@ IL_007b: ret } // end of method Loops::ForLoop - .method public hidebysig static void ForeachExceptForContinuedUse(class [mscorlib]System.Collections.Generic.IEnumerable`1 inputs) cil managed - { - // Code size 76 (0x4c) - .maxstack 2 - .locals init (int32 V_0, - class [mscorlib]System.Collections.Generic.IEnumerator`1 V_1) - IL_0000: ldstr "ForeachExceptForContinuedUse" - IL_0005: call void [mscorlib]System.Console::WriteLine(string) - IL_000a: ldc.i4.0 - IL_000b: stloc.0 - IL_000c: ldarg.0 - IL_000d: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerator`1 class [mscorlib]System.Collections.Generic.IEnumerable`1::GetEnumerator() - IL_0012: stloc.1 - .try - { - IL_0013: br.s IL_0022 - - IL_0015: ldloc.1 - IL_0016: callvirt instance !0 class [mscorlib]System.Collections.Generic.IEnumerator`1::get_Current() - IL_001b: stloc.0 - IL_001c: ldloc.0 - IL_001d: call void [mscorlib]System.Console::WriteLine(int32) - IL_0022: ldloc.1 - IL_0023: callvirt instance bool [mscorlib]System.Collections.IEnumerator::MoveNext() - IL_0028: brtrue.s IL_0015 - - IL_002a: leave.s IL_0036 - - } // end .try - finally - { - IL_002c: ldloc.1 - IL_002d: brfalse.s IL_0035 - - IL_002f: ldloc.1 - IL_0030: callvirt instance void [mscorlib]System.IDisposable::Dispose() - IL_0035: endfinally - } // end handler - IL_0036: ldstr "Last: " - IL_003b: ldloc.0 - IL_003c: box [mscorlib]System.Int32 - IL_0041: call string [mscorlib]System.String::Concat(object, - object) - IL_0046: call void [mscorlib]System.Console::WriteLine(string) - IL_004b: ret - } // end of method Loops::ForeachExceptForContinuedUse - - .method public hidebysig static void NonGenericForeachWithReturnFallbackTest(class [mscorlib]System.Collections.IEnumerable e) cil managed - { - // Code size 88 (0x58) - .maxstack 2 - .locals init (class [mscorlib]System.Collections.IEnumerator V_0, - object V_1, - class [mscorlib]System.IDisposable V_2) - IL_0000: ldstr "NonGenericForeachWithReturnFallback:" - IL_0005: call void [mscorlib]System.Console::WriteLine(string) - IL_000a: ldarg.0 - IL_000b: callvirt instance class [mscorlib]System.Collections.IEnumerator [mscorlib]System.Collections.IEnumerable::GetEnumerator() - IL_0010: stloc.0 - .try - { - IL_0011: ldstr "MoveNext" - IL_0016: call void [mscorlib]System.Console::WriteLine(string) - IL_001b: ldloc.0 - IL_001c: callvirt instance bool [mscorlib]System.Collections.IEnumerator::MoveNext() - IL_0021: brfalse.s IL_003a - - IL_0023: ldloc.0 - IL_0024: callvirt instance object [mscorlib]System.Collections.IEnumerator::get_Current() - IL_0029: stloc.1 - IL_002a: ldstr "current: " - IL_002f: ldloc.1 - IL_0030: call string [mscorlib]System.String::Concat(object, - object) - IL_0035: call void [mscorlib]System.Console::WriteLine(string) - IL_003a: leave.s IL_004d - - } // end .try - finally - { - IL_003c: ldloc.0 - IL_003d: isinst [mscorlib]System.IDisposable - IL_0042: stloc.2 - IL_0043: ldloc.2 - IL_0044: brfalse.s IL_004c - - IL_0046: ldloc.2 - IL_0047: callvirt instance void [mscorlib]System.IDisposable::Dispose() - IL_004c: endfinally - } // end handler - IL_004d: ldstr "After finally!" - IL_0052: call void [mscorlib]System.Console::WriteLine(string) - IL_0057: ret - } // end of method Loops::NonGenericForeachWithReturnFallbackTest - .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { diff --git a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/Loops.roslyn.il b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/Loops.roslyn.il index b5b720de7..c01d6d552 100644 --- a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/Loops.roslyn.il +++ b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/Loops.roslyn.il @@ -25,14 +25,14 @@ .ver 0:0:0:0 } .module Loops.dll -// MVID: {C3B63F66-C940-45B6-9786-076A79DB1EC5} +// MVID: {58DE4DF4-CF99-4DFB-BA97-F0BB418C7543} .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: 0x011E0000 +// Image base: 0x007E0000 // =============== CLASS MEMBERS DECLARATION =================== @@ -40,6 +40,566 @@ .class public auto ansi beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops extends [mscorlib]System.Object { + .class auto ansi nested public beforefieldinit CustomClassEnumerator + extends [mscorlib]System.Object + { + .method public hidebysig specialname + instance object get_Current() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: nop + IL_0001: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0006: throw + } // end of method CustomClassEnumerator::get_Current + + .method public hidebysig instance bool + MoveNext() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: nop + IL_0001: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0006: throw + } // end of method CustomClassEnumerator::MoveNext + + .method public hidebysig instance void + Reset() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: nop + IL_0001: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0006: throw + } // end of method CustomClassEnumerator::Reset + + .method public hidebysig instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumerator + GetEnumerator() cil managed + { + // Code size 7 (0x7) + .maxstack 1 + .locals init (class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumerator V_0) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: stloc.0 + IL_0003: br.s IL_0005 + + IL_0005: ldloc.0 + IL_0006: ret + } // end of method CustomClassEnumerator::GetEnumerator + + .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 CustomClassEnumerator::.ctor + + .property instance object Current() + { + .get instance object ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumerator::get_Current() + } // end of property CustomClassEnumerator::Current + } // end of class CustomClassEnumerator + + .class sequential ansi sealed nested public beforefieldinit CustomStructEnumerator + extends [mscorlib]System.ValueType + { + .pack 0 + .size 1 + .method public hidebysig specialname + instance object get_Current() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: nop + IL_0001: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0006: throw + } // end of method CustomStructEnumerator::get_Current + + .method public hidebysig instance bool + MoveNext() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: nop + IL_0001: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0006: throw + } // end of method CustomStructEnumerator::MoveNext + + .method public hidebysig instance void + Reset() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: nop + IL_0001: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0006: throw + } // end of method CustomStructEnumerator::Reset + + .method public hidebysig instance valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumerator + GetEnumerator() cil managed + { + // Code size 12 (0xc) + .maxstack 1 + .locals init (valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumerator V_0) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldobj ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumerator + IL_0007: stloc.0 + IL_0008: br.s IL_000a + + IL_000a: ldloc.0 + IL_000b: ret + } // end of method CustomStructEnumerator::GetEnumerator + + .property instance object Current() + { + .get instance object ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumerator::get_Current() + } // end of property CustomStructEnumerator::Current + } // end of class CustomStructEnumerator + + .class auto ansi nested public beforefieldinit CustomClassEnumerator`1 + extends [mscorlib]System.Object + { + .method public hidebysig specialname + instance !T get_Current() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: nop + IL_0001: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0006: throw + } // end of method CustomClassEnumerator`1::get_Current + + .method public hidebysig instance void + Dispose() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: nop + IL_0001: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0006: throw + } // end of method CustomClassEnumerator`1::Dispose + + .method public hidebysig instance bool + MoveNext() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: nop + IL_0001: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0006: throw + } // end of method CustomClassEnumerator`1::MoveNext + + .method public hidebysig instance void + Reset() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: nop + IL_0001: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0006: throw + } // end of method CustomClassEnumerator`1::Reset + + .method public hidebysig instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumerator`1 + GetEnumerator() cil managed + { + // Code size 7 (0x7) + .maxstack 1 + .locals init (class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumerator`1 V_0) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: stloc.0 + IL_0003: br.s IL_0005 + + IL_0005: ldloc.0 + IL_0006: ret + } // end of method CustomClassEnumerator`1::GetEnumerator + + .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 CustomClassEnumerator`1::.ctor + + .property instance !T Current() + { + .get instance !T ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumerator`1::get_Current() + } // end of property CustomClassEnumerator`1::Current + } // end of class CustomClassEnumerator`1 + + .class sequential ansi sealed nested public beforefieldinit CustomStructEnumerator`1 + extends [mscorlib]System.ValueType + { + .pack 0 + .size 1 + .method public hidebysig specialname + instance !T get_Current() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: nop + IL_0001: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0006: throw + } // end of method CustomStructEnumerator`1::get_Current + + .method public hidebysig instance void + Dispose() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: nop + IL_0001: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0006: throw + } // end of method CustomStructEnumerator`1::Dispose + + .method public hidebysig instance bool + MoveNext() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: nop + IL_0001: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0006: throw + } // end of method CustomStructEnumerator`1::MoveNext + + .method public hidebysig instance void + Reset() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: nop + IL_0001: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0006: throw + } // end of method CustomStructEnumerator`1::Reset + + .method public hidebysig instance valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumerator`1 + GetEnumerator() cil managed + { + // Code size 12 (0xc) + .maxstack 1 + .locals init (valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumerator`1 V_0) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldobj valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumerator`1 + IL_0007: stloc.0 + IL_0008: br.s IL_000a + + IL_000a: ldloc.0 + IL_000b: ret + } // end of method CustomStructEnumerator`1::GetEnumerator + + .property instance !T Current() + { + .get instance !T ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumerator`1::get_Current() + } // end of property CustomStructEnumerator`1::Current + } // end of class CustomStructEnumerator`1 + + .class auto ansi nested public beforefieldinit CustomClassEnumeratorWithIDisposable + extends [mscorlib]System.Object + implements [mscorlib]System.IDisposable + { + .method public hidebysig specialname + instance object get_Current() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: nop + IL_0001: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0006: throw + } // end of method CustomClassEnumeratorWithIDisposable::get_Current + + .method public hidebysig newslot virtual final + instance void Dispose() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: nop + IL_0001: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0006: throw + } // end of method CustomClassEnumeratorWithIDisposable::Dispose + + .method public hidebysig instance bool + MoveNext() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: nop + IL_0001: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0006: throw + } // end of method CustomClassEnumeratorWithIDisposable::MoveNext + + .method public hidebysig instance void + Reset() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: nop + IL_0001: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0006: throw + } // end of method CustomClassEnumeratorWithIDisposable::Reset + + .method public hidebysig instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumeratorWithIDisposable + GetEnumerator() cil managed + { + // Code size 7 (0x7) + .maxstack 1 + .locals init (class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumeratorWithIDisposable V_0) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: stloc.0 + IL_0003: br.s IL_0005 + + IL_0005: ldloc.0 + IL_0006: ret + } // end of method CustomClassEnumeratorWithIDisposable::GetEnumerator + + .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 CustomClassEnumeratorWithIDisposable::.ctor + + .property instance object Current() + { + .get instance object ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumeratorWithIDisposable::get_Current() + } // end of property CustomClassEnumeratorWithIDisposable::Current + } // end of class CustomClassEnumeratorWithIDisposable + + .class sequential ansi sealed nested public beforefieldinit CustomStructEnumeratorWithIDisposable + extends [mscorlib]System.ValueType + implements [mscorlib]System.IDisposable + { + .pack 0 + .size 1 + .method public hidebysig specialname + instance object get_Current() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: nop + IL_0001: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0006: throw + } // end of method CustomStructEnumeratorWithIDisposable::get_Current + + .method public hidebysig newslot virtual final + instance void Dispose() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: nop + IL_0001: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0006: throw + } // end of method CustomStructEnumeratorWithIDisposable::Dispose + + .method public hidebysig instance bool + MoveNext() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: nop + IL_0001: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0006: throw + } // end of method CustomStructEnumeratorWithIDisposable::MoveNext + + .method public hidebysig instance void + Reset() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: nop + IL_0001: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0006: throw + } // end of method CustomStructEnumeratorWithIDisposable::Reset + + .method public hidebysig instance valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable + GetEnumerator() cil managed + { + // Code size 12 (0xc) + .maxstack 1 + .locals init (valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable V_0) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldobj ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable + IL_0007: stloc.0 + IL_0008: br.s IL_000a + + IL_000a: ldloc.0 + IL_000b: ret + } // end of method CustomStructEnumeratorWithIDisposable::GetEnumerator + + .property instance object Current() + { + .get instance object ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable::get_Current() + } // end of property CustomStructEnumeratorWithIDisposable::Current + } // end of class CustomStructEnumeratorWithIDisposable + + .class auto ansi nested public beforefieldinit CustomClassEnumeratorWithIDisposable`1 + extends [mscorlib]System.Object + implements [mscorlib]System.IDisposable + { + .method public hidebysig specialname + instance !T get_Current() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: nop + IL_0001: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0006: throw + } // end of method CustomClassEnumeratorWithIDisposable`1::get_Current + + .method public hidebysig newslot virtual final + instance void Dispose() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: nop + IL_0001: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0006: throw + } // end of method CustomClassEnumeratorWithIDisposable`1::Dispose + + .method public hidebysig instance bool + MoveNext() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: nop + IL_0001: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0006: throw + } // end of method CustomClassEnumeratorWithIDisposable`1::MoveNext + + .method public hidebysig instance void + Reset() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: nop + IL_0001: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0006: throw + } // end of method CustomClassEnumeratorWithIDisposable`1::Reset + + .method public hidebysig instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumeratorWithIDisposable`1 + GetEnumerator() cil managed + { + // Code size 7 (0x7) + .maxstack 1 + .locals init (class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumeratorWithIDisposable`1 V_0) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: stloc.0 + IL_0003: br.s IL_0005 + + IL_0005: ldloc.0 + IL_0006: ret + } // end of method CustomClassEnumeratorWithIDisposable`1::GetEnumerator + + .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 CustomClassEnumeratorWithIDisposable`1::.ctor + + .property instance !T Current() + { + .get instance !T ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumeratorWithIDisposable`1::get_Current() + } // end of property CustomClassEnumeratorWithIDisposable`1::Current + } // end of class CustomClassEnumeratorWithIDisposable`1 + + .class sequential ansi sealed nested public beforefieldinit CustomStructEnumeratorWithIDisposable`1 + extends [mscorlib]System.ValueType + implements [mscorlib]System.IDisposable + { + .pack 0 + .size 1 + .method public hidebysig specialname + instance !T get_Current() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: nop + IL_0001: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0006: throw + } // end of method CustomStructEnumeratorWithIDisposable`1::get_Current + + .method public hidebysig newslot virtual final + instance void Dispose() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: nop + IL_0001: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0006: throw + } // end of method CustomStructEnumeratorWithIDisposable`1::Dispose + + .method public hidebysig instance bool + MoveNext() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: nop + IL_0001: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0006: throw + } // end of method CustomStructEnumeratorWithIDisposable`1::MoveNext + + .method public hidebysig instance void + Reset() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: nop + IL_0001: newobj instance void [mscorlib]System.NotImplementedException::.ctor() + IL_0006: throw + } // end of method CustomStructEnumeratorWithIDisposable`1::Reset + + .method public hidebysig instance valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable`1 + GetEnumerator() cil managed + { + // Code size 12 (0xc) + .maxstack 1 + .locals init (valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable`1 V_0) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldobj valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable`1 + IL_0007: stloc.0 + IL_0008: br.s IL_000a + + IL_000a: ldloc.0 + IL_000b: ret + } // end of method CustomStructEnumeratorWithIDisposable`1::GetEnumerator + + .property instance !T Current() + { + .get instance !T ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable`1::get_Current() + } // end of property CustomStructEnumeratorWithIDisposable`1::Current + } // end of class CustomStructEnumeratorWithIDisposable`1 + + .method private hidebysig static void Operation(int32& item) cil managed + { + // Code size 2 (0x2) + .maxstack 8 + IL_0000: nop + IL_0001: ret + } // end of method Loops::Operation + .method public hidebysig instance void ForEach(class [mscorlib]System.Collections.Generic.IEnumerable`1 enumerable) cil managed { @@ -272,6 +832,389 @@ IL_003c: ret } // end of method Loops::ForEachOverNonGenericEnumerableWithAutomaticCastRefType + .method public hidebysig instance void + ForEachOnCustomClassEnumerator(class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumerator e) cil managed + { + // Code size 56 (0x38) + .maxstack 1 + .locals init (class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumerator 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 ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumerator ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumerator::GetEnumerator() + IL_0008: stloc.0 + .try + { + IL_0009: br.s IL_001b + + IL_000b: ldloc.0 + IL_000c: callvirt instance object ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumerator::get_Current() + IL_0011: stloc.1 + IL_0012: nop + IL_0013: ldloc.1 + IL_0014: call void [mscorlib]System.Console::WriteLine(object) + IL_0019: nop + IL_001a: nop + IL_001b: ldloc.0 + IL_001c: callvirt instance bool ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumerator::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::ForEachOnCustomClassEnumerator + + .method public hidebysig instance void + ForEachOnGenericCustomClassEnumerator(class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumerator`1 e) cil managed + { + // Code size 61 (0x3d) + .maxstack 1 + .locals init (class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumerator`1 V_0, + !!T V_1, + class [mscorlib]System.IDisposable V_2) + IL_0000: nop + IL_0001: nop + IL_0002: ldarg.1 + IL_0003: callvirt instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumerator`1 class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumerator`1::GetEnumerator() + IL_0008: stloc.0 + .try + { + IL_0009: br.s IL_0020 + + IL_000b: ldloc.0 + IL_000c: callvirt instance !0 class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumerator`1::get_Current() + IL_0011: stloc.1 + IL_0012: nop + IL_0013: ldloc.1 + IL_0014: box !!T + IL_0019: call void [mscorlib]System.Console::WriteLine(object) + IL_001e: nop + IL_001f: nop + IL_0020: ldloc.0 + IL_0021: callvirt instance bool class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumerator`1::MoveNext() + IL_0026: brtrue.s IL_000b + + IL_0028: leave.s IL_003c + + } // end .try + finally + { + IL_002a: ldloc.0 + IL_002b: isinst [mscorlib]System.IDisposable + IL_0030: stloc.2 + IL_0031: ldloc.2 + IL_0032: brfalse.s IL_003b + + IL_0034: ldloc.2 + IL_0035: callvirt instance void [mscorlib]System.IDisposable::Dispose() + IL_003a: nop + IL_003b: endfinally + } // end handler + IL_003c: ret + } // end of method Loops::ForEachOnGenericCustomClassEnumerator + + .method public hidebysig instance void + ForEachOnCustomClassEnumeratorWithIDisposable(class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumeratorWithIDisposable e) cil managed + { + // Code size 49 (0x31) + .maxstack 1 + .locals init (class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumeratorWithIDisposable V_0, + object V_1) + IL_0000: nop + IL_0001: nop + IL_0002: ldarg.1 + IL_0003: callvirt instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumeratorWithIDisposable ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumeratorWithIDisposable::GetEnumerator() + IL_0008: stloc.0 + .try + { + IL_0009: br.s IL_001b + + IL_000b: ldloc.0 + IL_000c: callvirt instance object ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumeratorWithIDisposable::get_Current() + IL_0011: stloc.1 + IL_0012: nop + IL_0013: ldloc.1 + IL_0014: call void [mscorlib]System.Console::WriteLine(object) + IL_0019: nop + IL_001a: nop + IL_001b: ldloc.0 + IL_001c: callvirt instance bool ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumeratorWithIDisposable::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::ForEachOnCustomClassEnumeratorWithIDisposable + + .method public hidebysig instance void + ForEachOnCustomStructEnumeratorWithIDisposable(valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable e) cil managed + { + // Code size 56 (0x38) + .maxstack 1 + .locals init (valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable V_0, + object V_1) + IL_0000: nop + IL_0001: nop + IL_0002: ldarga.s e + IL_0004: call instance valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable::GetEnumerator() + IL_0009: stloc.0 + .try + { + IL_000a: br.s IL_001d + + IL_000c: ldloca.s V_0 + IL_000e: call instance object ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable::get_Current() + IL_0013: stloc.1 + IL_0014: nop + IL_0015: ldloc.1 + IL_0016: call void [mscorlib]System.Console::WriteLine(object) + IL_001b: nop + IL_001c: nop + IL_001d: ldloca.s V_0 + IL_001f: call instance bool ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable::MoveNext() + IL_0024: brtrue.s IL_000c + + IL_0026: leave.s IL_0037 + + } // end .try + finally + { + IL_0028: ldloca.s V_0 + IL_002a: constrained. ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable + IL_0030: callvirt instance void [mscorlib]System.IDisposable::Dispose() + IL_0035: nop + IL_0036: endfinally + } // end handler + IL_0037: ret + } // end of method Loops::ForEachOnCustomStructEnumeratorWithIDisposable + + .method public hidebysig instance void + ForEachOnGenericCustomClassEnumeratorWithIDisposable(class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumeratorWithIDisposable`1 e) cil managed + { + // Code size 54 (0x36) + .maxstack 1 + .locals init (class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumeratorWithIDisposable`1 V_0, + !!T V_1) + IL_0000: nop + IL_0001: nop + IL_0002: ldarg.1 + IL_0003: callvirt instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumeratorWithIDisposable`1 class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumeratorWithIDisposable`1::GetEnumerator() + IL_0008: stloc.0 + .try + { + IL_0009: br.s IL_0020 + + IL_000b: ldloc.0 + IL_000c: callvirt instance !0 class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumeratorWithIDisposable`1::get_Current() + IL_0011: stloc.1 + IL_0012: nop + IL_0013: ldloc.1 + IL_0014: box !!T + IL_0019: call void [mscorlib]System.Console::WriteLine(object) + IL_001e: nop + IL_001f: nop + IL_0020: ldloc.0 + IL_0021: callvirt instance bool class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomClassEnumeratorWithIDisposable`1::MoveNext() + IL_0026: brtrue.s IL_000b + + IL_0028: leave.s IL_0035 + + } // end .try + finally + { + IL_002a: ldloc.0 + IL_002b: brfalse.s IL_0034 + + IL_002d: ldloc.0 + IL_002e: callvirt instance void [mscorlib]System.IDisposable::Dispose() + IL_0033: nop + IL_0034: endfinally + } // end handler + IL_0035: ret + } // end of method Loops::ForEachOnGenericCustomClassEnumeratorWithIDisposable + + .method public hidebysig instance void + ForEachOnGenericCustomStructEnumeratorWithIDisposable(valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable`1 e) cil managed + { + // Code size 61 (0x3d) + .maxstack 1 + .locals init (valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable`1 V_0, + !!T V_1) + IL_0000: nop + IL_0001: nop + IL_0002: ldarga.s e + IL_0004: call instance valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable`1 valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable`1::GetEnumerator() + IL_0009: stloc.0 + .try + { + IL_000a: br.s IL_0022 + + IL_000c: ldloca.s V_0 + IL_000e: call instance !0 valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable`1::get_Current() + IL_0013: stloc.1 + IL_0014: nop + IL_0015: ldloc.1 + IL_0016: box !!T + IL_001b: call void [mscorlib]System.Console::WriteLine(object) + IL_0020: nop + IL_0021: nop + IL_0022: ldloca.s V_0 + IL_0024: call instance bool valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable`1::MoveNext() + IL_0029: brtrue.s IL_000c + + IL_002b: leave.s IL_003c + + } // end .try + finally + { + IL_002d: ldloca.s V_0 + IL_002f: constrained. valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops/CustomStructEnumeratorWithIDisposable`1 + IL_0035: callvirt instance void [mscorlib]System.IDisposable::Dispose() + IL_003a: nop + IL_003b: endfinally + } // end handler + IL_003c: ret + } // end of method Loops::ForEachOnGenericCustomStructEnumeratorWithIDisposable + + .method public hidebysig static void NonGenericForeachWithReturnFallbackTest(class [mscorlib]System.Collections.IEnumerable e) cil managed + { + // Code size 109 (0x6d) + .maxstack 2 + .locals init (class [mscorlib]System.Collections.IEnumerator V_0, + bool V_1, + object V_2, + class [mscorlib]System.IDisposable V_3, + bool V_4) + IL_0000: nop + IL_0001: ldstr "NonGenericForeachWithReturnFallback:" + IL_0006: call void [mscorlib]System.Console::WriteLine(string) + IL_000b: nop + IL_000c: ldarg.0 + IL_000d: callvirt instance class [mscorlib]System.Collections.IEnumerator [mscorlib]System.Collections.IEnumerable::GetEnumerator() + IL_0012: stloc.0 + .try + { + IL_0013: nop + IL_0014: ldstr "MoveNext" + IL_0019: call void [mscorlib]System.Console::WriteLine(string) + IL_001e: nop + IL_001f: ldloc.0 + IL_0020: callvirt instance bool [mscorlib]System.Collections.IEnumerator::MoveNext() + IL_0025: stloc.1 + IL_0026: ldloc.1 + IL_0027: brfalse.s IL_0043 + + IL_0029: nop + IL_002a: ldloc.0 + IL_002b: callvirt instance object [mscorlib]System.Collections.IEnumerator::get_Current() + IL_0030: stloc.2 + IL_0031: ldstr "current: " + IL_0036: ldloc.2 + IL_0037: call string [mscorlib]System.String::Concat(object, + object) + IL_003c: call void [mscorlib]System.Console::WriteLine(string) + IL_0041: nop + IL_0042: nop + IL_0043: nop + IL_0044: leave.s IL_0061 + + } // end .try + finally + { + IL_0046: nop + IL_0047: ldloc.0 + IL_0048: isinst [mscorlib]System.IDisposable + IL_004d: stloc.3 + IL_004e: ldloc.3 + IL_004f: ldnull + IL_0050: cgt.un + IL_0052: stloc.s V_4 + IL_0054: ldloc.s V_4 + IL_0056: brfalse.s IL_005f + + IL_0058: ldloc.3 + IL_0059: callvirt instance void [mscorlib]System.IDisposable::Dispose() + IL_005e: nop + IL_005f: nop + IL_0060: endfinally + } // end handler + IL_0061: ldstr "After finally!" + IL_0066: call void [mscorlib]System.Console::WriteLine(string) + IL_006b: nop + IL_006c: ret + } // end of method Loops::NonGenericForeachWithReturnFallbackTest + + .method public hidebysig static void ForeachWithRefUsage(class [mscorlib]System.Collections.Generic.List`1 items) cil managed + { + // Code size 58 (0x3a) + .maxstack 1 + .locals init (valuetype [mscorlib]System.Collections.Generic.List`1/Enumerator V_0, + int32 V_1, + int32 V_2) + IL_0000: nop + IL_0001: nop + IL_0002: ldarg.0 + 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_001f + + 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: stloc.2 + IL_0016: ldloca.s V_2 + IL_0018: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops::Operation(int32&) + IL_001d: nop + IL_001e: nop + IL_001f: ldloca.s V_0 + IL_0021: call instance bool valuetype [mscorlib]System.Collections.Generic.List`1/Enumerator::MoveNext() + IL_0026: brtrue.s IL_000b + + IL_0028: leave.s IL_0039 + + } // end .try + finally + { + IL_002a: ldloca.s V_0 + IL_002c: constrained. valuetype [mscorlib]System.Collections.Generic.List`1/Enumerator + IL_0032: callvirt instance void [mscorlib]System.IDisposable::Dispose() + IL_0037: nop + IL_0038: endfinally + } // end handler + IL_0039: ret + } // end of method Loops::ForeachWithRefUsage + .method public hidebysig instance void ForOverArray(string[] 'array') cil managed { @@ -562,135 +1505,6 @@ IL_009d: ret } // end of method Loops::ForLoop - .method public hidebysig static void ForeachExceptForContinuedUse(class [mscorlib]System.Collections.Generic.IEnumerable`1 inputs) cil managed - { - // Code size 87 (0x57) - .maxstack 2 - .locals init (int32 V_0, - class [mscorlib]System.Collections.Generic.IEnumerator`1 V_1, - bool V_2) - IL_0000: nop - IL_0001: ldstr "ForeachExceptForContinuedUse" - IL_0006: call void [mscorlib]System.Console::WriteLine(string) - IL_000b: nop - IL_000c: ldc.i4.0 - IL_000d: stloc.0 - IL_000e: ldarg.0 - IL_000f: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerator`1 class [mscorlib]System.Collections.Generic.IEnumerable`1::GetEnumerator() - IL_0014: stloc.1 - .try - { - IL_0015: nop - IL_0016: br.s IL_0028 - - IL_0018: nop - IL_0019: ldloc.1 - IL_001a: callvirt instance !0 class [mscorlib]System.Collections.Generic.IEnumerator`1::get_Current() - IL_001f: stloc.0 - IL_0020: ldloc.0 - IL_0021: call void [mscorlib]System.Console::WriteLine(int32) - IL_0026: nop - IL_0027: nop - IL_0028: ldloc.1 - IL_0029: callvirt instance bool [mscorlib]System.Collections.IEnumerator::MoveNext() - IL_002e: stloc.2 - IL_002f: ldloc.2 - IL_0030: brtrue.s IL_0018 - - IL_0032: nop - IL_0033: leave.s IL_0040 - - } // end .try - finally - { - IL_0035: ldloc.1 - IL_0036: brfalse.s IL_003f - - IL_0038: ldloc.1 - IL_0039: callvirt instance void [mscorlib]System.IDisposable::Dispose() - IL_003e: nop - IL_003f: endfinally - } // end handler - IL_0040: ldstr "Last: " - IL_0045: ldloc.0 - IL_0046: box [mscorlib]System.Int32 - IL_004b: call string [mscorlib]System.String::Concat(object, - object) - IL_0050: call void [mscorlib]System.Console::WriteLine(string) - IL_0055: nop - IL_0056: ret - } // end of method Loops::ForeachExceptForContinuedUse - - .method public hidebysig static void NonGenericForeachWithReturnFallbackTest(class [mscorlib]System.Collections.IEnumerable e) cil managed - { - // Code size 111 (0x6f) - .maxstack 2 - .locals init (class [mscorlib]System.Collections.IEnumerator V_0, - bool V_1, - object V_2, - class [mscorlib]System.IDisposable V_3, - bool V_4) - IL_0000: nop - IL_0001: ldstr "NonGenericForeachWithReturnFallback:" - IL_0006: call void [mscorlib]System.Console::WriteLine(string) - IL_000b: nop - IL_000c: ldarg.0 - IL_000d: callvirt instance class [mscorlib]System.Collections.IEnumerator [mscorlib]System.Collections.IEnumerable::GetEnumerator() - IL_0012: stloc.0 - .try - { - IL_0013: nop - IL_0014: ldstr "MoveNext" - IL_0019: call void [mscorlib]System.Console::WriteLine(string) - IL_001e: nop - IL_001f: ldloc.0 - IL_0020: callvirt instance bool [mscorlib]System.Collections.IEnumerator::MoveNext() - IL_0025: stloc.1 - IL_0026: ldloc.1 - IL_0027: brfalse.s IL_0043 - - IL_0029: nop - IL_002a: ldloc.0 - IL_002b: callvirt instance object [mscorlib]System.Collections.IEnumerator::get_Current() - IL_0030: stloc.2 - IL_0031: ldstr "current: " - IL_0036: ldloc.2 - IL_0037: call string [mscorlib]System.String::Concat(object, - object) - IL_003c: call void [mscorlib]System.Console::WriteLine(string) - IL_0041: nop - IL_0042: nop - IL_0043: nop - IL_0044: leave.s IL_0063 - - } // end .try - finally - { - IL_0046: nop - IL_0047: ldloc.0 - IL_0048: isinst [mscorlib]System.IDisposable - IL_004d: stloc.3 - IL_004e: ldloc.3 - IL_004f: ldnull - IL_0050: cgt.un - IL_0052: stloc.s V_4 - IL_0054: ldloc.s V_4 - IL_0056: brfalse.s IL_0061 - - IL_0058: nop - IL_0059: ldloc.3 - IL_005a: callvirt instance void [mscorlib]System.IDisposable::Dispose() - IL_005f: nop - IL_0060: nop - IL_0061: nop - IL_0062: endfinally - } // end handler - IL_0063: ldstr "After finally!" - IL_0068: call void [mscorlib]System.Console::WriteLine(string) - IL_006d: nop - IL_006e: ret - } // end of method Loops::NonGenericForeachWithReturnFallbackTest - .method public hidebysig specialname rtspecialname instance void .ctor() cil managed {