diff --git a/ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj b/ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj
index 2dbbf54e8..ff698da2a 100644
--- a/ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj
+++ b/ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj
@@ -74,6 +74,7 @@
+
diff --git a/ICSharpCode.Decompiler.Tests/PrettyTestRunner.cs b/ICSharpCode.Decompiler.Tests/PrettyTestRunner.cs
index 285f3a86c..b863ae06f 100644
--- a/ICSharpCode.Decompiler.Tests/PrettyTestRunner.cs
+++ b/ICSharpCode.Decompiler.Tests/PrettyTestRunner.cs
@@ -85,31 +85,31 @@ namespace ICSharpCode.Decompiler.Tests
}
[Test]
- public void InlineAssignmentTest([ValueSource("defaultOptions")] CSharpCompilerOptions cscOptions)
+ public void InlineAssignmentTest([ValueSource(nameof(defaultOptions))] CSharpCompilerOptions cscOptions)
{
RunForLibrary(cscOptions: cscOptions);
}
[Test]
- public void CompoundAssignmentTest([ValueSource("defaultOptions")] CSharpCompilerOptions cscOptions)
+ public void CompoundAssignmentTest([ValueSource(nameof(defaultOptions))] CSharpCompilerOptions cscOptions)
{
RunForLibrary(cscOptions: cscOptions);
}
[Test]
- public void ShortCircuit([ValueSource("defaultOptions")] CSharpCompilerOptions cscOptions)
+ public void ShortCircuit([ValueSource(nameof(defaultOptions))] CSharpCompilerOptions cscOptions)
{
RunForLibrary(cscOptions: cscOptions);
}
[Test]
- public void CustomShortCircuitOperators([ValueSource("defaultOptions")] CSharpCompilerOptions cscOptions)
+ public void CustomShortCircuitOperators([ValueSource(nameof(defaultOptions))] CSharpCompilerOptions cscOptions)
{
RunForLibrary(cscOptions: cscOptions);
}
[Test]
- public void ExceptionHandling([ValueSource("defaultOptions")] CSharpCompilerOptions cscOptions)
+ public void ExceptionHandling([ValueSource(nameof(defaultOptions))] CSharpCompilerOptions cscOptions)
{
RunForLibrary(cscOptions: cscOptions, decompilerSettings: new DecompilerSettings {
NullPropagation = false,
@@ -119,7 +119,7 @@ namespace ICSharpCode.Decompiler.Tests
}
[Test]
- public void Switch([ValueSource("defaultOptions")] CSharpCompilerOptions cscOptions)
+ public void Switch([ValueSource(nameof(defaultOptions))] CSharpCompilerOptions cscOptions)
{
RunForLibrary(cscOptions: cscOptions, decompilerSettings: new DecompilerSettings {
// legacy csc generates a dead store in debug builds
@@ -128,49 +128,49 @@ namespace ICSharpCode.Decompiler.Tests
}
[Test]
- public void DelegateConstruction([ValueSource("defaultOptions")] CSharpCompilerOptions cscOptions)
+ public void DelegateConstruction([ValueSource(nameof(defaultOptions))] CSharpCompilerOptions cscOptions)
{
RunForLibrary(cscOptions: cscOptions);
}
[Test]
- public void AnonymousTypes([ValueSource("defaultOptionsWithMcs")] CSharpCompilerOptions cscOptions)
+ public void AnonymousTypes([ValueSource(nameof(defaultOptionsWithMcs))] CSharpCompilerOptions cscOptions)
{
RunForLibrary(cscOptions: cscOptions);
}
[Test]
- public void Async([ValueSource("defaultOptions")] CSharpCompilerOptions cscOptions)
+ public void Async([ValueSource(nameof(defaultOptions))] CSharpCompilerOptions cscOptions)
{
RunForLibrary(cscOptions: cscOptions);
}
[Test]
- public void Lock([ValueSource("defaultOptionsWithMcs")] CSharpCompilerOptions cscOptions)
+ public void Lock([ValueSource(nameof(defaultOptionsWithMcs))] CSharpCompilerOptions cscOptions)
{
RunForLibrary(cscOptions: cscOptions);
}
[Test]
- public void Using([ValueSource("defaultOptions")] CSharpCompilerOptions cscOptions)
+ public void Using([ValueSource(nameof(defaultOptions))] CSharpCompilerOptions cscOptions)
{
RunForLibrary(cscOptions: cscOptions);
}
[Test]
- public void LiftedOperators([ValueSource("defaultOptions")] CSharpCompilerOptions cscOptions)
+ public void LiftedOperators([ValueSource(nameof(defaultOptions))] CSharpCompilerOptions cscOptions)
{
RunForLibrary(cscOptions: cscOptions);
}
[Test]
- public void Generics([ValueSource("defaultOptions")] CSharpCompilerOptions cscOptions)
+ public void Generics([ValueSource(nameof(defaultOptions))] CSharpCompilerOptions cscOptions)
{
RunForLibrary(cscOptions: cscOptions);
}
[Test]
- public void Loops([ValueSource("defaultOptionsWithMcs")] CSharpCompilerOptions cscOptions)
+ public void Loops([ValueSource(nameof(defaultOptionsWithMcs))] CSharpCompilerOptions cscOptions)
{
RunForLibrary(cscOptions: cscOptions, decompilerSettings: new DecompilerSettings {
// legacy csc generates a dead store in debug builds
@@ -179,62 +179,62 @@ namespace ICSharpCode.Decompiler.Tests
}
[Test]
- public void PropertiesAndEvents([ValueSource("defaultOptions")] CSharpCompilerOptions cscOptions)
+ public void PropertiesAndEvents([ValueSource(nameof(defaultOptions))] CSharpCompilerOptions cscOptions)
{
RunForLibrary(cscOptions: cscOptions);
}
[Test]
- public void AutoProperties([ValueSource("roslynOnlyOptions")] CSharpCompilerOptions cscOptions)
+ public void AutoProperties([ValueSource(nameof(roslynOnlyOptions))] CSharpCompilerOptions cscOptions)
{
RunForLibrary(cscOptions: cscOptions);
}
[Test]
- public void QueryExpressions([ValueSource("defaultOptions")] CSharpCompilerOptions cscOptions)
+ public void QueryExpressions([ValueSource(nameof(defaultOptions))] CSharpCompilerOptions cscOptions)
{
RunForLibrary(cscOptions: cscOptions);
}
[Test]
- public void TypeAnalysisTests([ValueSource("defaultOptions")] CSharpCompilerOptions cscOptions)
+ public void TypeAnalysisTests([ValueSource(nameof(defaultOptions))] CSharpCompilerOptions cscOptions)
{
RunForLibrary(cscOptions: cscOptions);
}
[Test]
- public void CheckedUnchecked([ValueSource("defaultOptions")] CSharpCompilerOptions cscOptions)
+ public void CheckedUnchecked([ValueSource(nameof(defaultOptions))] CSharpCompilerOptions cscOptions)
{
RunForLibrary(cscOptions: cscOptions);
}
[Test]
- public void UnsafeCode([ValueSource("defaultOptions")] CSharpCompilerOptions cscOptions)
+ public void UnsafeCode([ValueSource(nameof(defaultOptions))] CSharpCompilerOptions cscOptions)
{
RunForLibrary(cscOptions: cscOptions);
}
[Test]
- public void PInvoke([ValueSource("defaultOptions")] CSharpCompilerOptions cscOptions)
+ public void PInvoke([ValueSource(nameof(defaultOptions))] CSharpCompilerOptions cscOptions)
{
// This tests needs our own disassembler; ildasm has a bug with marshalinfo.
RunForLibrary(cscOptions: cscOptions, asmOptions: AssemblerOptions.UseOwnDisassembler);
}
[Test]
- public void InitializerTests([ValueSource("defaultOptions")] CSharpCompilerOptions cscOptions)
+ public void InitializerTests([ValueSource(nameof(defaultOptions))] CSharpCompilerOptions cscOptions)
{
RunForLibrary(cscOptions: cscOptions);
}
[Test]
- public void DynamicTests([ValueSource("defaultOptions")] CSharpCompilerOptions cscOptions)
+ public void DynamicTests([ValueSource(nameof(defaultOptions))] CSharpCompilerOptions cscOptions)
{
RunForLibrary(cscOptions: cscOptions);
}
[Test]
- public void ExpressionTrees([ValueSource("defaultOptions")] CSharpCompilerOptions cscOptions)
+ public void ExpressionTrees([ValueSource(nameof(defaultOptions))] CSharpCompilerOptions cscOptions)
{
RunForLibrary(cscOptions: cscOptions);
}
@@ -246,73 +246,73 @@ namespace ICSharpCode.Decompiler.Tests
}
[Test]
- public void VariableNaming([ValueSource("defaultOptions")] CSharpCompilerOptions cscOptions)
+ public void VariableNaming([ValueSource(nameof(defaultOptions))] CSharpCompilerOptions cscOptions)
{
RunForLibrary(cscOptions: cscOptions);
}
[Test]
- public void VariableNamingWithoutSymbols([ValueSource("defaultOptions")] CSharpCompilerOptions cscOptions)
+ public void VariableNamingWithoutSymbols([ValueSource(nameof(defaultOptions))] CSharpCompilerOptions cscOptions)
{
RunForLibrary(cscOptions: cscOptions, decompilerSettings: new DecompilerSettings { UseDebugSymbols = false });
}
[Test]
- public void CS72_PrivateProtected([ValueSource("roslynOnlyOptions")] CSharpCompilerOptions cscOptions)
+ public void CS72_PrivateProtected([ValueSource(nameof(roslynOnlyOptions))] CSharpCompilerOptions cscOptions)
{
RunForLibrary(cscOptions: cscOptions);
}
[Test]
- public void AsyncMain([ValueSource("roslynOnlyOptions")] CSharpCompilerOptions cscOptions)
+ public void AsyncMain([ValueSource(nameof(roslynOnlyOptions))] CSharpCompilerOptions cscOptions)
{
Run(cscOptions: cscOptions);
}
[Test]
- public void NullPropagation([ValueSource("roslynOnlyOptions")] CSharpCompilerOptions cscOptions)
+ public void NullPropagation([ValueSource(nameof(roslynOnlyOptions))] CSharpCompilerOptions cscOptions)
{
RunForLibrary(cscOptions: cscOptions);
}
[Test]
- public void CS6_StringInterpolation([ValueSource("roslynOnlyOptions")] CSharpCompilerOptions cscOptions)
+ public void CS6_StringInterpolation([ValueSource(nameof(roslynOnlyOptions))] CSharpCompilerOptions cscOptions)
{
Run(cscOptions: cscOptions);
}
[Test]
- public void RefLocalsAndReturns([ValueSource("roslynOnlyOptions")] CSharpCompilerOptions cscOptions)
+ public void RefLocalsAndReturns([ValueSource(nameof(roslynOnlyOptions))] CSharpCompilerOptions cscOptions)
{
RunForLibrary(cscOptions: cscOptions);
}
[Test]
- public void WellKnownConstants([ValueSource("defaultOptions")] CSharpCompilerOptions cscOptions)
+ public void WellKnownConstants([ValueSource(nameof(defaultOptions))] CSharpCompilerOptions cscOptions)
{
RunForLibrary(cscOptions: cscOptions);
}
[Test]
- public void QualifierTests([ValueSource("defaultOptions")] CSharpCompilerOptions cscOptions)
+ public void QualifierTests([ValueSource(nameof(defaultOptions))] CSharpCompilerOptions cscOptions)
{
RunForLibrary(cscOptions: cscOptions);
}
[Test]
- public void TupleTests([ValueSource("roslynOnlyOptions")] CSharpCompilerOptions cscOptions)
+ public void TupleTests([ValueSource(nameof(roslynOnlyOptions))] CSharpCompilerOptions cscOptions)
{
RunForLibrary(cscOptions: cscOptions);
}
[Test]
- public void NamedArguments([ValueSource("defaultOptions")] CSharpCompilerOptions cscOptions)
+ public void NamedArguments([ValueSource(nameof(defaultOptions))] CSharpCompilerOptions cscOptions)
{
RunForLibrary(cscOptions: cscOptions);
}
[Test]
- public void OptionalArguments([ValueSource("defaultOptions")] CSharpCompilerOptions cscOptions)
+ public void OptionalArguments([ValueSource(nameof(defaultOptions))] CSharpCompilerOptions cscOptions)
{
RunForLibrary(cscOptions: cscOptions);
}
@@ -348,13 +348,19 @@ namespace ICSharpCode.Decompiler.Tests
}
[Test]
- public void MemberTests([ValueSource("defaultOptions")] CSharpCompilerOptions cscOptions)
+ public void MemberTests([ValueSource(nameof(defaultOptions))] CSharpCompilerOptions cscOptions)
{
RunForLibrary(cscOptions: cscOptions);
}
[Test]
- public void TypeTests([ValueSource("defaultOptions")] CSharpCompilerOptions cscOptions)
+ public void TypeTests([ValueSource(nameof(defaultOptions))] CSharpCompilerOptions cscOptions)
+ {
+ RunForLibrary(cscOptions: cscOptions);
+ }
+
+ [Test]
+ public void YieldReturn([ValueSource(nameof(defaultOptions))] CSharpCompilerOptions cscOptions)
{
RunForLibrary(cscOptions: cscOptions);
}
diff --git a/ICSharpCode.Decompiler.Tests/TestCases/Correctness/YieldReturn.cs b/ICSharpCode.Decompiler.Tests/TestCases/Correctness/YieldReturn.cs
index 18483b8cd..6398f740b 100644
--- a/ICSharpCode.Decompiler.Tests/TestCases/Correctness/YieldReturn.cs
+++ b/ICSharpCode.Decompiler.Tests/TestCases/Correctness/YieldReturn.cs
@@ -76,6 +76,14 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness
int fieldOnThis;
+ public static IEnumerable YieldChars {
+ get {
+ yield return 'a';
+ yield return 'b';
+ yield return 'c';
+ }
+ }
+
public static IEnumerable SimpleYieldReturn()
{
yield return "A";
@@ -188,8 +196,9 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness
yield return "E";
yield return "F";
// outer try-finally block
- foreach (string line in input)
+ foreach (string line in input) {
yield return line.ToUpper();
+ }
}
public static IEnumerable> YieldReturnWithAnonymousMethods1(IEnumerable input)
@@ -210,17 +219,9 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness
public static IEnumerable GetEvenNumbers(int n)
{
for (int i = 0; i < n; i++) {
- if (i % 2 == 0)
+ if (i % 2 == 0) {
yield return i;
- }
- }
-
- public static IEnumerable YieldChars
- {
- get {
- yield return 'a';
- yield return 'b';
- yield return 'c';
+ }
}
}
@@ -283,7 +284,8 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness
yield return 0;
try {
Console.WriteLine("In Try");
- yield break; // same compiler bug as in YieldBreakInCatchInTryFinally
+ // same compiler bug as in YieldBreakInCatchInTryFinally
+ yield break;
} catch {
Console.WriteLine("Catch");
}
@@ -299,8 +301,10 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness
yield return 0;
try {
Console.WriteLine("In Try");
- if (b)
- yield break; // same compiler bug as in YieldBreakInCatchInTryFinally
+ if (b) {
+ // same compiler bug as in YieldBreakInCatchInTryFinally
+ yield break;
+ }
} finally {
Console.WriteLine("Inner Finally");
}
@@ -406,7 +410,6 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness
public static IEnumerable TryFinallyWithTwoExitPointsInNestedCatch(bool b)
{
- // The first user IL instruction is already in 2 nested try blocks.
try {
yield return 1;
try {
@@ -434,9 +437,9 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness
try {
yield return 2;
} finally {
- T b = a;
- b.Dispose();
- b.Dispose();
+ T val = a;
+ val.Dispose();
+ val.Dispose();
}
yield return 3;
}
diff --git a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/YieldReturn.cs b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/YieldReturn.cs
new file mode 100644
index 000000000..c2c19ce21
--- /dev/null
+++ b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/YieldReturn.cs
@@ -0,0 +1,339 @@
+// Copyright (c) AlphaSierraPapa for the SharpDevelop Team
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy of this
+// software and associated documentation files (the "Software"), to deal in the Software
+// without restriction, including without limitation the rights to use, copy, modify, merge,
+// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
+// to whom the Software is furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in all copies or
+// substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
+// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
+// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+// DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+
+namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
+{
+ public class YieldReturnPrettyTest
+ {
+ private int fieldOnThis;
+
+ public static IEnumerable YieldChars {
+ get {
+ yield return 'a';
+ yield return 'b';
+ yield return 'c';
+ }
+ }
+
+ internal static void Print(string name, IEnumerator enumerator)
+ {
+ Console.WriteLine(name + ": Test start");
+ while (enumerator.MoveNext()) {
+ Console.WriteLine(name + ": " + enumerator.Current);
+ }
+ }
+
+ public static IEnumerable SimpleYieldReturn()
+ {
+ yield return "A";
+ yield return "B";
+ yield return "C";
+ }
+
+ public static IEnumerator SimpleYieldReturnEnumerator()
+ {
+ yield return "A";
+ yield return "B";
+ yield return "C";
+ }
+
+ public IEnumerable YieldReturnParameters(int p)
+ {
+ yield return p;
+ yield return fieldOnThis;
+ }
+
+ public IEnumerator YieldReturnParametersEnumerator(int p)
+ {
+ yield return p;
+ yield return fieldOnThis;
+ }
+
+ public static IEnumerable YieldReturnInLoop()
+ {
+ for (int i = 0; i < 100; i++) {
+ yield return i;
+ }
+ }
+
+ public static IEnumerable YieldReturnWithTryFinally()
+ {
+ yield return 0;
+ try {
+ yield return 1;
+ } finally {
+ Console.WriteLine("Finally!");
+ }
+ yield return 2;
+ }
+
+#if TODO
+ // TODO: adjust lock-pattern for this case
+ public static IEnumerable YieldReturnInLock1(object o)
+ {
+ lock (o) {
+ yield return 1;
+ }
+ }
+
+ public static IEnumerable YieldReturnInLock2(object o)
+ {
+ lock (o) {
+ yield return 1;
+ o = null;
+ yield return 2;
+ }
+ }
+#endif
+
+ public static IEnumerable YieldReturnWithNestedTryFinally(bool breakInMiddle)
+ {
+ Console.WriteLine("Start of method - 1");
+ yield return "Start of method";
+ Console.WriteLine("Start of method - 2");
+ try {
+ Console.WriteLine("Within outer try - 1");
+ yield return "Within outer try";
+ Console.WriteLine("Within outer try - 2");
+ try {
+ Console.WriteLine("Within inner try - 1");
+ yield return "Within inner try";
+ Console.WriteLine("Within inner try - 2");
+ if (breakInMiddle) {
+ Console.WriteLine("Breaking...");
+ yield break;
+ }
+ Console.WriteLine("End of inner try - 1");
+ yield return "End of inner try";
+ Console.WriteLine("End of inner try - 2");
+ } finally {
+ Console.WriteLine("Inner Finally");
+ }
+ Console.WriteLine("End of outer try - 1");
+ yield return "End of outer try";
+ Console.WriteLine("End of outer try - 2");
+ } finally {
+ Console.WriteLine("Outer Finally");
+ }
+ Console.WriteLine("End of method - 1");
+ yield return "End of method";
+ Console.WriteLine("End of method - 2");
+ }
+
+ public static IEnumerable YieldReturnWithTwoNonNestedFinallyBlocks(IEnumerable input)
+ {
+ // outer try-finally block
+ foreach (string line in input) {
+ // nested try-finally block
+ try {
+ yield return line;
+ } finally {
+ Console.WriteLine("Processed " + line);
+ }
+ }
+ yield return "A";
+ yield return "B";
+ yield return "C";
+ yield return "D";
+ yield return "E";
+ yield return "F";
+ // outer try-finally block
+ foreach (string item in input) {
+ yield return item.ToUpper();
+ }
+ }
+
+ public static IEnumerable> YieldReturnWithAnonymousMethods1(IEnumerable input)
+ {
+ foreach (string line in input) {
+ yield return () => line;
+ }
+ }
+
+ public static IEnumerable> YieldReturnWithAnonymousMethods2(IEnumerable input)
+ {
+ foreach (string item in input) {
+ string copy = item;
+ yield return () => copy;
+ }
+ }
+
+ public static IEnumerable GetEvenNumbers(int n)
+ {
+ for (int i = 0; i < n; i++) {
+ if (i % 2 == 0) {
+ yield return i;
+ }
+ }
+ }
+
+ public static IEnumerable ExceptionHandling()
+ {
+ yield return 'a';
+ try {
+ Console.WriteLine("1 - try");
+ } catch (Exception) {
+ Console.WriteLine("1 - catch");
+ }
+ yield return 'b';
+ try {
+ try {
+ Console.WriteLine("2 - try");
+ } finally {
+ Console.WriteLine("2 - finally");
+ }
+ yield return 'c';
+ } finally {
+ Console.WriteLine("outer finally");
+ }
+ }
+
+ public static IEnumerable YieldBreakInCatch()
+ {
+ yield return 0;
+ try {
+ Console.WriteLine("In Try");
+ } catch {
+ // yield return is not allowed in catch, but yield break is
+ yield break;
+ }
+ yield return 1;
+ }
+
+ public static IEnumerable YieldBreakInCatchInTryFinally()
+ {
+ try {
+ yield return 0;
+ try {
+ Console.WriteLine("In Try");
+ } catch {
+ // yield return is not allowed in catch, but yield break is
+ // Note that pre-roslyn, this code triggers a compiler bug:
+ // If the finally block throws an exception, it ends up getting
+ // called a second time.
+ yield break;
+ }
+ yield return 1;
+ } finally {
+ Console.WriteLine("Finally");
+ }
+ }
+
+ public static IEnumerable YieldBreakInTryCatchInTryFinally()
+ {
+ try {
+ yield return 0;
+ try {
+ Console.WriteLine("In Try");
+ // same compiler bug as in YieldBreakInCatchInTryFinally
+ yield break;
+ } catch {
+ Console.WriteLine("Catch");
+ }
+ yield return 1;
+ } finally {
+ Console.WriteLine("Finally");
+ }
+ }
+
+ public static IEnumerable YieldBreakInTryFinallyInTryFinally(bool b)
+ {
+ try {
+ yield return 0;
+ try {
+ Console.WriteLine("In Try");
+ if (b) {
+ // same compiler bug as in YieldBreakInCatchInTryFinally
+ yield break;
+ }
+ } finally {
+ Console.WriteLine("Inner Finally");
+ }
+ yield return 1;
+ } finally {
+ Console.WriteLine("Finally");
+ }
+ }
+
+ public static IEnumerable YieldBreakOnly()
+ {
+ yield break;
+ }
+
+ public static IEnumerable UnconditionalThrowInTryFinally()
+ {
+ // Here, MoveNext() doesn't call the finally methods at all
+ // (only indirectly via Dispose())
+ try {
+ yield return 0;
+ throw new NotImplementedException();
+ } finally {
+ Console.WriteLine("Finally");
+ }
+ }
+
+ public static IEnumerable NestedTryFinallyStartingOnSamePosition()
+ {
+ // The first user IL instruction is already in 2 nested try blocks.
+ try {
+ try {
+ yield return 0;
+ } finally {
+ Console.WriteLine("Inner Finally");
+ }
+ } finally {
+ Console.WriteLine("Outer Finally");
+ }
+ }
+
+ public static IEnumerable LocalInFinally(T a) where T : IDisposable
+ {
+ yield return 1;
+ try {
+ yield return 2;
+ } finally {
+ T val = a;
+ val.Dispose();
+ val.Dispose();
+ }
+ yield return 3;
+ }
+
+ public static IEnumerable GenericYield() where T : new()
+ {
+ T val = new T();
+ for (int i = 0; i < 3; i++) {
+ yield return val;
+ }
+ }
+ }
+
+ internal struct StructWithYieldReturn
+ {
+ private int val;
+
+ public IEnumerable Count()
+ {
+ yield return val++;
+ yield return val++;
+ }
+ }
+}
\ No newline at end of file
diff --git a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/YieldReturn.il b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/YieldReturn.il
new file mode 100644
index 000000000..5fd9effa9
--- /dev/null
+++ b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/YieldReturn.il
@@ -0,0 +1,7400 @@
+
+
+
+
+// Metadata version: v4.0.30319
+.assembly extern mscorlib
+{
+ .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
+ .ver 4:0:0:0
+}
+.assembly YieldReturn
+{
+ .custom instance void [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = ( 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx
+ 63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows.
+ .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 00 00 00 00 00 )
+ .permissionset reqmin
+ = {[mscorlib]System.Security.Permissions.SecurityPermissionAttribute = {property bool 'SkipVerification' = bool(true)}}
+ .hash algorithm 0x00008004
+ .ver 0:0:0:0
+}
+.module YieldReturn.dll
+.custom instance void [mscorlib]System.Security.UnverifiableCodeAttribute::.ctor() = ( 01 00 00 00 )
+.imagebase 0x10000000
+.file alignment 0x00000200
+.stackreserve 0x00100000
+.subsystem 0x0003 // WINDOWS_CUI
+.corflags 0x00000001 // ILONLY
+
+
+// =============== CLASS MEMBERS DECLARATION ===================
+
+.class public auto ansi beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest
+ extends [mscorlib]System.Object
+{
+ .class auto ansi sealed nested private beforefieldinit 'd__0'
+ extends [mscorlib]System.Object
+ implements class [mscorlib]System.Collections.Generic.IEnumerable`1,
+ [mscorlib]System.Collections.IEnumerable,
+ class [mscorlib]System.Collections.Generic.IEnumerator`1,
+ [mscorlib]System.Collections.IEnumerator,
+ [mscorlib]System.IDisposable
+ {
+ .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
+ .field private char '<>2__current'
+ .field private int32 '<>1__state'
+ .field private int32 '<>l__initialThreadId'
+ .method private hidebysig newslot virtual final
+ instance class [mscorlib]System.Collections.Generic.IEnumerator`1
+ 'System.Collections.Generic.IEnumerable.GetEnumerator'() cil managed
+ {
+ .custom instance void [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::.ctor() = ( 01 00 00 00 )
+ .override method instance class [mscorlib]System.Collections.Generic.IEnumerator`1 class [mscorlib]System.Collections.Generic.IEnumerable`1::GetEnumerator()
+ // Code size 58 (0x3a)
+ .maxstack 2
+ .locals init (class ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__0' V_0,
+ class [mscorlib]System.Collections.Generic.IEnumerator`1 V_1,
+ bool V_2)
+ IL_0000: call int32 [mscorlib]System.Environment::get_CurrentManagedThreadId()
+ IL_0005: ldarg.0
+ IL_0006: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__0'::'<>l__initialThreadId'
+ IL_000b: bne.un.s IL_001c
+
+ IL_000d: ldarg.0
+ IL_000e: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__0'::'<>1__state'
+ IL_0013: ldc.i4.s -2
+ IL_0015: ceq
+ IL_0017: ldc.i4.0
+ IL_0018: ceq
+ IL_001a: br.s IL_001d
+
+ IL_001c: ldc.i4.1
+ IL_001d: nop
+ IL_001e: stloc.2
+ IL_001f: ldloc.2
+ IL_0020: brtrue.s IL_002d
+
+ IL_0022: ldarg.0
+ IL_0023: ldc.i4.0
+ IL_0024: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__0'::'<>1__state'
+ IL_0029: ldarg.0
+ IL_002a: stloc.0
+ IL_002b: br.s IL_0034
+
+ IL_002d: ldc.i4.0
+ IL_002e: newobj instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__0'::.ctor(int32)
+ IL_0033: stloc.0
+ IL_0034: ldloc.0
+ IL_0035: stloc.1
+ IL_0036: br.s IL_0038
+
+ IL_0038: ldloc.1
+ IL_0039: ret
+ } // end of method 'd__0'::'System.Collections.Generic.IEnumerable.GetEnumerator'
+
+ .method private hidebysig newslot virtual final
+ instance class [mscorlib]System.Collections.IEnumerator
+ System.Collections.IEnumerable.GetEnumerator() cil managed
+ {
+ .custom instance void [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::.ctor() = ( 01 00 00 00 )
+ .override [mscorlib]System.Collections.IEnumerable::GetEnumerator
+ // Code size 11 (0xb)
+ .maxstack 1
+ .locals init (class [mscorlib]System.Collections.IEnumerator V_0)
+ IL_0000: ldarg.0
+ IL_0001: call instance class [mscorlib]System.Collections.Generic.IEnumerator`1 ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__0'::'System.Collections.Generic.IEnumerable.GetEnumerator'()
+ IL_0006: stloc.0
+ IL_0007: br.s IL_0009
+
+ IL_0009: ldloc.0
+ IL_000a: ret
+ } // end of method 'd__0'::System.Collections.IEnumerable.GetEnumerator
+
+ .method private hidebysig newslot virtual final
+ instance bool MoveNext() cil managed
+ {
+ .override [mscorlib]System.Collections.IEnumerator::MoveNext
+ // Code size 134 (0x86)
+ .maxstack 2
+ .locals init (bool V_0,
+ int32 V_1)
+ IL_0000: ldarg.0
+ IL_0001: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__0'::'<>1__state'
+ IL_0006: stloc.1
+ IL_0007: ldloc.1
+ IL_0008: switch (
+ IL_0025,
+ IL_001f,
+ IL_0021,
+ IL_0023)
+ IL_001d: br.s IL_0027
+
+ IL_001f: br.s IL_0044
+
+ IL_0021: br.s IL_005e
+
+ IL_0023: br.s IL_0078
+
+ IL_0025: br.s IL_0029
+
+ IL_0027: br.s IL_0080
+
+ IL_0029: ldarg.0
+ IL_002a: ldc.i4.m1
+ IL_002b: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__0'::'<>1__state'
+ IL_0030: nop
+ IL_0031: ldarg.0
+ IL_0032: ldc.i4.s 97
+ IL_0034: stfld char ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__0'::'<>2__current'
+ IL_0039: ldarg.0
+ IL_003a: ldc.i4.1
+ IL_003b: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__0'::'<>1__state'
+ IL_0040: ldc.i4.1
+ IL_0041: stloc.0
+ IL_0042: br.s IL_0084
+
+ IL_0044: ldarg.0
+ IL_0045: ldc.i4.m1
+ IL_0046: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__0'::'<>1__state'
+ IL_004b: ldarg.0
+ IL_004c: ldc.i4.s 98
+ IL_004e: stfld char ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__0'::'<>2__current'
+ IL_0053: ldarg.0
+ IL_0054: ldc.i4.2
+ IL_0055: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__0'::'<>1__state'
+ IL_005a: ldc.i4.1
+ IL_005b: stloc.0
+ IL_005c: br.s IL_0084
+
+ IL_005e: ldarg.0
+ IL_005f: ldc.i4.m1
+ IL_0060: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__0'::'<>1__state'
+ IL_0065: ldarg.0
+ IL_0066: ldc.i4.s 99
+ IL_0068: stfld char ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__0'::'<>2__current'
+ IL_006d: ldarg.0
+ IL_006e: ldc.i4.3
+ IL_006f: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__0'::'<>1__state'
+ IL_0074: ldc.i4.1
+ IL_0075: stloc.0
+ IL_0076: br.s IL_0084
+
+ IL_0078: ldarg.0
+ IL_0079: ldc.i4.m1
+ IL_007a: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__0'::'<>1__state'
+ IL_007f: nop
+ IL_0080: ldc.i4.0
+ IL_0081: stloc.0
+ IL_0082: br.s IL_0084
+
+ IL_0084: ldloc.0
+ IL_0085: ret
+ } // end of method 'd__0'::MoveNext
+
+ .method private hidebysig newslot specialname virtual final
+ instance char 'System.Collections.Generic.IEnumerator.get_Current'() cil managed
+ {
+ .custom instance void [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::.ctor() = ( 01 00 00 00 )
+ .override method instance !0 class [mscorlib]System.Collections.Generic.IEnumerator`1::get_Current()
+ // Code size 11 (0xb)
+ .maxstack 1
+ .locals init (char V_0)
+ IL_0000: ldarg.0
+ IL_0001: ldfld char ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__0'::'<>2__current'
+ IL_0006: stloc.0
+ IL_0007: br.s IL_0009
+
+ IL_0009: ldloc.0
+ IL_000a: ret
+ } // end of method 'd__0'::'System.Collections.Generic.IEnumerator.get_Current'
+
+ .method private hidebysig newslot virtual final
+ instance void System.Collections.IEnumerator.Reset() cil managed
+ {
+ .custom instance void [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::.ctor() = ( 01 00 00 00 )
+ .override [mscorlib]System.Collections.IEnumerator::Reset
+ // Code size 6 (0x6)
+ .maxstack 8
+ IL_0000: newobj instance void [mscorlib]System.NotSupportedException::.ctor()
+ IL_0005: throw
+ } // end of method 'd__0'::System.Collections.IEnumerator.Reset
+
+ .method private hidebysig newslot virtual final
+ instance void System.IDisposable.Dispose() cil managed
+ {
+ .override [mscorlib]System.IDisposable::Dispose
+ // Code size 2 (0x2)
+ .maxstack 8
+ IL_0000: nop
+ IL_0001: ret
+ } // end of method 'd__0'::System.IDisposable.Dispose
+
+ .method private hidebysig newslot specialname virtual final
+ instance object System.Collections.IEnumerator.get_Current() cil managed
+ {
+ .custom instance void [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::.ctor() = ( 01 00 00 00 )
+ .override [mscorlib]System.Collections.IEnumerator::get_Current
+ // Code size 16 (0x10)
+ .maxstack 1
+ .locals init (object V_0)
+ IL_0000: ldarg.0
+ IL_0001: ldfld char ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__0'::'<>2__current'
+ IL_0006: box [mscorlib]System.Char
+ IL_000b: stloc.0
+ IL_000c: br.s IL_000e
+
+ IL_000e: ldloc.0
+ IL_000f: ret
+ } // end of method 'd__0'::System.Collections.IEnumerator.get_Current
+
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor(int32 '<>1__state') cil managed
+ {
+ .custom instance void [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::.ctor() = ( 01 00 00 00 )
+ // Code size 25 (0x19)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ldarg.0
+ IL_0007: ldarg.1
+ IL_0008: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__0'::'<>1__state'
+ IL_000d: ldarg.0
+ IL_000e: call int32 [mscorlib]System.Environment::get_CurrentManagedThreadId()
+ IL_0013: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__0'::'<>l__initialThreadId'
+ IL_0018: ret
+ } // end of method 'd__0'::.ctor
+
+ .property instance char 'System.Collections.Generic.IEnumerator.Current'()
+ {
+ .get instance char ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__0'::'System.Collections.Generic.IEnumerator.get_Current'()
+ } // end of property 'd__0'::'System.Collections.Generic.IEnumerator.Current'
+ .property instance object System.Collections.IEnumerator.Current()
+ {
+ .get instance object ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__0'::System.Collections.IEnumerator.get_Current()
+ } // end of property 'd__0'::System.Collections.IEnumerator.Current
+ } // end of class 'd__0'
+
+ .class auto ansi sealed nested private beforefieldinit 'd__3'
+ extends [mscorlib]System.Object
+ implements class [mscorlib]System.Collections.Generic.IEnumerable`1,
+ [mscorlib]System.Collections.IEnumerable,
+ class [mscorlib]System.Collections.Generic.IEnumerator`1,
+ [mscorlib]System.Collections.IEnumerator,
+ [mscorlib]System.IDisposable
+ {
+ .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
+ .field private string '<>2__current'
+ .field private int32 '<>1__state'
+ .field private int32 '<>l__initialThreadId'
+ .method private hidebysig newslot virtual final
+ instance class [mscorlib]System.Collections.Generic.IEnumerator`1
+ 'System.Collections.Generic.IEnumerable.GetEnumerator'() cil managed
+ {
+ .custom instance void [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::.ctor() = ( 01 00 00 00 )
+ .override method instance class [mscorlib]System.Collections.Generic.IEnumerator`1 class [mscorlib]System.Collections.Generic.IEnumerable`1::GetEnumerator()
+ // Code size 58 (0x3a)
+ .maxstack 2
+ .locals init (class ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__3' V_0,
+ class [mscorlib]System.Collections.Generic.IEnumerator`1 V_1,
+ bool V_2)
+ IL_0000: call int32 [mscorlib]System.Environment::get_CurrentManagedThreadId()
+ IL_0005: ldarg.0
+ IL_0006: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__3'::'<>l__initialThreadId'
+ IL_000b: bne.un.s IL_001c
+
+ IL_000d: ldarg.0
+ IL_000e: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__3'::'<>1__state'
+ IL_0013: ldc.i4.s -2
+ IL_0015: ceq
+ IL_0017: ldc.i4.0
+ IL_0018: ceq
+ IL_001a: br.s IL_001d
+
+ IL_001c: ldc.i4.1
+ IL_001d: nop
+ IL_001e: stloc.2
+ IL_001f: ldloc.2
+ IL_0020: brtrue.s IL_002d
+
+ IL_0022: ldarg.0
+ IL_0023: ldc.i4.0
+ IL_0024: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__3'::'<>1__state'
+ IL_0029: ldarg.0
+ IL_002a: stloc.0
+ IL_002b: br.s IL_0034
+
+ IL_002d: ldc.i4.0
+ IL_002e: newobj instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__3'::.ctor(int32)
+ IL_0033: stloc.0
+ IL_0034: ldloc.0
+ IL_0035: stloc.1
+ IL_0036: br.s IL_0038
+
+ IL_0038: ldloc.1
+ IL_0039: ret
+ } // end of method 'd__3'::'System.Collections.Generic.IEnumerable.GetEnumerator'
+
+ .method private hidebysig newslot virtual final
+ instance class [mscorlib]System.Collections.IEnumerator
+ System.Collections.IEnumerable.GetEnumerator() cil managed
+ {
+ .custom instance void [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::.ctor() = ( 01 00 00 00 )
+ .override [mscorlib]System.Collections.IEnumerable::GetEnumerator
+ // Code size 11 (0xb)
+ .maxstack 1
+ .locals init (class [mscorlib]System.Collections.IEnumerator V_0)
+ IL_0000: ldarg.0
+ IL_0001: call instance class [mscorlib]System.Collections.Generic.IEnumerator`1 ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__3'::'System.Collections.Generic.IEnumerable.GetEnumerator'()
+ IL_0006: stloc.0
+ IL_0007: br.s IL_0009
+
+ IL_0009: ldloc.0
+ IL_000a: ret
+ } // end of method 'd__3'::System.Collections.IEnumerable.GetEnumerator
+
+ .method private hidebysig newslot virtual final
+ instance bool MoveNext() cil managed
+ {
+ .override [mscorlib]System.Collections.IEnumerator::MoveNext
+ // Code size 143 (0x8f)
+ .maxstack 2
+ .locals init (bool V_0,
+ int32 V_1)
+ IL_0000: ldarg.0
+ IL_0001: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__3'::'<>1__state'
+ IL_0006: stloc.1
+ IL_0007: ldloc.1
+ IL_0008: switch (
+ IL_0025,
+ IL_001f,
+ IL_0021,
+ IL_0023)
+ IL_001d: br.s IL_0027
+
+ IL_001f: br.s IL_0047
+
+ IL_0021: br.s IL_0064
+
+ IL_0023: br.s IL_0081
+
+ IL_0025: br.s IL_0029
+
+ IL_0027: br.s IL_0089
+
+ IL_0029: ldarg.0
+ IL_002a: ldc.i4.m1
+ IL_002b: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__3'::'<>1__state'
+ IL_0030: nop
+ IL_0031: ldarg.0
+ IL_0032: ldstr "A"
+ IL_0037: stfld string ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__3'::'<>2__current'
+ IL_003c: ldarg.0
+ IL_003d: ldc.i4.1
+ IL_003e: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__3'::'<>1__state'
+ IL_0043: ldc.i4.1
+ IL_0044: stloc.0
+ IL_0045: br.s IL_008d
+
+ IL_0047: ldarg.0
+ IL_0048: ldc.i4.m1
+ IL_0049: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__3'::'<>1__state'
+ IL_004e: ldarg.0
+ IL_004f: ldstr "B"
+ IL_0054: stfld string ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__3'::'<>2__current'
+ IL_0059: ldarg.0
+ IL_005a: ldc.i4.2
+ IL_005b: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__3'::'<>1__state'
+ IL_0060: ldc.i4.1
+ IL_0061: stloc.0
+ IL_0062: br.s IL_008d
+
+ IL_0064: ldarg.0
+ IL_0065: ldc.i4.m1
+ IL_0066: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__3'::'<>1__state'
+ IL_006b: ldarg.0
+ IL_006c: ldstr "C"
+ IL_0071: stfld string ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__3'::'<>2__current'
+ IL_0076: ldarg.0
+ IL_0077: ldc.i4.3
+ IL_0078: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__3'::'<>1__state'
+ IL_007d: ldc.i4.1
+ IL_007e: stloc.0
+ IL_007f: br.s IL_008d
+
+ IL_0081: ldarg.0
+ IL_0082: ldc.i4.m1
+ IL_0083: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__3'::'<>1__state'
+ IL_0088: nop
+ IL_0089: ldc.i4.0
+ IL_008a: stloc.0
+ IL_008b: br.s IL_008d
+
+ IL_008d: ldloc.0
+ IL_008e: ret
+ } // end of method 'd__3'::MoveNext
+
+ .method private hidebysig newslot specialname virtual final
+ instance string 'System.Collections.Generic.IEnumerator.get_Current'() cil managed
+ {
+ .custom instance void [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::.ctor() = ( 01 00 00 00 )
+ .override method instance !0 class [mscorlib]System.Collections.Generic.IEnumerator`1::get_Current()
+ // Code size 11 (0xb)
+ .maxstack 1
+ .locals init (string V_0)
+ IL_0000: ldarg.0
+ IL_0001: ldfld string ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__3'::'<>2__current'
+ IL_0006: stloc.0
+ IL_0007: br.s IL_0009
+
+ IL_0009: ldloc.0
+ IL_000a: ret
+ } // end of method 'd__3'::'System.Collections.Generic.IEnumerator.get_Current'
+
+ .method private hidebysig newslot virtual final
+ instance void System.Collections.IEnumerator.Reset() cil managed
+ {
+ .custom instance void [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::.ctor() = ( 01 00 00 00 )
+ .override [mscorlib]System.Collections.IEnumerator::Reset
+ // Code size 6 (0x6)
+ .maxstack 8
+ IL_0000: newobj instance void [mscorlib]System.NotSupportedException::.ctor()
+ IL_0005: throw
+ } // end of method 'd__3'::System.Collections.IEnumerator.Reset
+
+ .method private hidebysig newslot virtual final
+ instance void System.IDisposable.Dispose() cil managed
+ {
+ .override [mscorlib]System.IDisposable::Dispose
+ // Code size 2 (0x2)
+ .maxstack 8
+ IL_0000: nop
+ IL_0001: ret
+ } // end of method 'd__3'::System.IDisposable.Dispose
+
+ .method private hidebysig newslot specialname virtual final
+ instance object System.Collections.IEnumerator.get_Current() cil managed
+ {
+ .custom instance void [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::.ctor() = ( 01 00 00 00 )
+ .override [mscorlib]System.Collections.IEnumerator::get_Current
+ // Code size 11 (0xb)
+ .maxstack 1
+ .locals init (object V_0)
+ IL_0000: ldarg.0
+ IL_0001: ldfld string ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__3'::'<>2__current'
+ IL_0006: stloc.0
+ IL_0007: br.s IL_0009
+
+ IL_0009: ldloc.0
+ IL_000a: ret
+ } // end of method 'd__3'::System.Collections.IEnumerator.get_Current
+
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor(int32 '<>1__state') cil managed
+ {
+ .custom instance void [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::.ctor() = ( 01 00 00 00 )
+ // Code size 25 (0x19)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ldarg.0
+ IL_0007: ldarg.1
+ IL_0008: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__3'::'<>1__state'
+ IL_000d: ldarg.0
+ IL_000e: call int32 [mscorlib]System.Environment::get_CurrentManagedThreadId()
+ IL_0013: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__3'::'<>l__initialThreadId'
+ IL_0018: ret
+ } // end of method 'd__3'::.ctor
+
+ .property instance string 'System.Collections.Generic.IEnumerator.Current'()
+ {
+ .get instance string ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__3'::'System.Collections.Generic.IEnumerator.get_Current'()
+ } // end of property 'd__3'::'System.Collections.Generic.IEnumerator.Current'
+ .property instance object System.Collections.IEnumerator.Current()
+ {
+ .get instance object ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__3'::System.Collections.IEnumerator.get_Current()
+ } // end of property 'd__3'::System.Collections.IEnumerator.Current
+ } // end of class 'd__3'
+
+ .class auto ansi sealed nested private beforefieldinit 'd__6'
+ extends [mscorlib]System.Object
+ implements class [mscorlib]System.Collections.Generic.IEnumerator`1,
+ [mscorlib]System.Collections.IEnumerator,
+ [mscorlib]System.IDisposable
+ {
+ .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
+ .field private string '<>2__current'
+ .field private int32 '<>1__state'
+ .method private hidebysig newslot virtual final
+ instance bool MoveNext() cil managed
+ {
+ .override [mscorlib]System.Collections.IEnumerator::MoveNext
+ // Code size 143 (0x8f)
+ .maxstack 2
+ .locals init (bool V_0,
+ int32 V_1)
+ IL_0000: ldarg.0
+ IL_0001: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__6'::'<>1__state'
+ IL_0006: stloc.1
+ IL_0007: ldloc.1
+ IL_0008: switch (
+ IL_0025,
+ IL_001f,
+ IL_0021,
+ IL_0023)
+ IL_001d: br.s IL_0027
+
+ IL_001f: br.s IL_0047
+
+ IL_0021: br.s IL_0064
+
+ IL_0023: br.s IL_0081
+
+ IL_0025: br.s IL_0029
+
+ IL_0027: br.s IL_0089
+
+ IL_0029: ldarg.0
+ IL_002a: ldc.i4.m1
+ IL_002b: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__6'::'<>1__state'
+ IL_0030: nop
+ IL_0031: ldarg.0
+ IL_0032: ldstr "A"
+ IL_0037: stfld string ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__6'::'<>2__current'
+ IL_003c: ldarg.0
+ IL_003d: ldc.i4.1
+ IL_003e: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__6'::'<>1__state'
+ IL_0043: ldc.i4.1
+ IL_0044: stloc.0
+ IL_0045: br.s IL_008d
+
+ IL_0047: ldarg.0
+ IL_0048: ldc.i4.m1
+ IL_0049: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__6'::'<>1__state'
+ IL_004e: ldarg.0
+ IL_004f: ldstr "B"
+ IL_0054: stfld string ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__6'::'<>2__current'
+ IL_0059: ldarg.0
+ IL_005a: ldc.i4.2
+ IL_005b: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__6'::'<>1__state'
+ IL_0060: ldc.i4.1
+ IL_0061: stloc.0
+ IL_0062: br.s IL_008d
+
+ IL_0064: ldarg.0
+ IL_0065: ldc.i4.m1
+ IL_0066: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__6'::'<>1__state'
+ IL_006b: ldarg.0
+ IL_006c: ldstr "C"
+ IL_0071: stfld string ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__6'::'<>2__current'
+ IL_0076: ldarg.0
+ IL_0077: ldc.i4.3
+ IL_0078: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__6'::'<>1__state'
+ IL_007d: ldc.i4.1
+ IL_007e: stloc.0
+ IL_007f: br.s IL_008d
+
+ IL_0081: ldarg.0
+ IL_0082: ldc.i4.m1
+ IL_0083: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__6'::'<>1__state'
+ IL_0088: nop
+ IL_0089: ldc.i4.0
+ IL_008a: stloc.0
+ IL_008b: br.s IL_008d
+
+ IL_008d: ldloc.0
+ IL_008e: ret
+ } // end of method 'd__6'::MoveNext
+
+ .method private hidebysig newslot specialname virtual final
+ instance string 'System.Collections.Generic.IEnumerator.get_Current'() cil managed
+ {
+ .custom instance void [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::.ctor() = ( 01 00 00 00 )
+ .override method instance !0 class [mscorlib]System.Collections.Generic.IEnumerator`1::get_Current()
+ // Code size 11 (0xb)
+ .maxstack 1
+ .locals init (string V_0)
+ IL_0000: ldarg.0
+ IL_0001: ldfld string ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__6'::'<>2__current'
+ IL_0006: stloc.0
+ IL_0007: br.s IL_0009
+
+ IL_0009: ldloc.0
+ IL_000a: ret
+ } // end of method 'd__6'::'System.Collections.Generic.IEnumerator.get_Current'
+
+ .method private hidebysig newslot virtual final
+ instance void System.Collections.IEnumerator.Reset() cil managed
+ {
+ .custom instance void [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::.ctor() = ( 01 00 00 00 )
+ .override [mscorlib]System.Collections.IEnumerator::Reset
+ // Code size 6 (0x6)
+ .maxstack 8
+ IL_0000: newobj instance void [mscorlib]System.NotSupportedException::.ctor()
+ IL_0005: throw
+ } // end of method 'd__6'::System.Collections.IEnumerator.Reset
+
+ .method private hidebysig newslot virtual final
+ instance void System.IDisposable.Dispose() cil managed
+ {
+ .override [mscorlib]System.IDisposable::Dispose
+ // Code size 2 (0x2)
+ .maxstack 8
+ IL_0000: nop
+ IL_0001: ret
+ } // end of method 'd__6'::System.IDisposable.Dispose
+
+ .method private hidebysig newslot specialname virtual final
+ instance object System.Collections.IEnumerator.get_Current() cil managed
+ {
+ .custom instance void [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::.ctor() = ( 01 00 00 00 )
+ .override [mscorlib]System.Collections.IEnumerator::get_Current
+ // Code size 11 (0xb)
+ .maxstack 1
+ .locals init (object V_0)
+ IL_0000: ldarg.0
+ IL_0001: ldfld string ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__6'::'<>2__current'
+ IL_0006: stloc.0
+ IL_0007: br.s IL_0009
+
+ IL_0009: ldloc.0
+ IL_000a: ret
+ } // end of method 'd__6'::System.Collections.IEnumerator.get_Current
+
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor(int32 '<>1__state') cil managed
+ {
+ .custom instance void [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::.ctor() = ( 01 00 00 00 )
+ // Code size 14 (0xe)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ldarg.0
+ IL_0007: ldarg.1
+ IL_0008: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__6'::'<>1__state'
+ IL_000d: ret
+ } // end of method 'd__6'::.ctor
+
+ .property instance string 'System.Collections.Generic.IEnumerator.Current'()
+ {
+ .get instance string ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__6'::'System.Collections.Generic.IEnumerator.get_Current'()
+ } // end of property 'd__6'::'System.Collections.Generic.IEnumerator.Current'
+ .property instance object System.Collections.IEnumerator.Current()
+ {
+ .get instance object ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__6'::System.Collections.IEnumerator.get_Current()
+ } // end of property 'd__6'::System.Collections.IEnumerator.Current
+ } // end of class 'd__6'
+
+ .class auto ansi sealed nested private beforefieldinit 'd__8'
+ extends [mscorlib]System.Object
+ implements class [mscorlib]System.Collections.Generic.IEnumerable`1,
+ [mscorlib]System.Collections.IEnumerable,
+ class [mscorlib]System.Collections.Generic.IEnumerator`1,
+ [mscorlib]System.Collections.IEnumerator,
+ [mscorlib]System.IDisposable
+ {
+ .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
+ .field private int32 '<>2__current'
+ .field private int32 '<>1__state'
+ .field private int32 '<>l__initialThreadId'
+ .field public class ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest '<>4__this'
+ .field public int32 p
+ .field public int32 '<>3__p'
+ .method private hidebysig newslot virtual final
+ instance class [mscorlib]System.Collections.Generic.IEnumerator`1
+ 'System.Collections.Generic.IEnumerable.GetEnumerator'() cil managed
+ {
+ .custom instance void [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::.ctor() = ( 01 00 00 00 )
+ .override method instance class [mscorlib]System.Collections.Generic.IEnumerator`1 class [mscorlib]System.Collections.Generic.IEnumerable`1::GetEnumerator()
+ // Code size 82 (0x52)
+ .maxstack 2
+ .locals init (class ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__8' V_0,
+ class [mscorlib]System.Collections.Generic.IEnumerator`1 V_1,
+ bool V_2)
+ IL_0000: call int32 [mscorlib]System.Environment::get_CurrentManagedThreadId()
+ IL_0005: ldarg.0
+ IL_0006: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__8'::'<>l__initialThreadId'
+ IL_000b: bne.un.s IL_001c
+
+ IL_000d: ldarg.0
+ IL_000e: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__8'::'<>1__state'
+ IL_0013: ldc.i4.s -2
+ IL_0015: ceq
+ IL_0017: ldc.i4.0
+ IL_0018: ceq
+ IL_001a: br.s IL_001d
+
+ IL_001c: ldc.i4.1
+ IL_001d: nop
+ IL_001e: stloc.2
+ IL_001f: ldloc.2
+ IL_0020: brtrue.s IL_002d
+
+ IL_0022: ldarg.0
+ IL_0023: ldc.i4.0
+ IL_0024: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__8'::'<>1__state'
+ IL_0029: ldarg.0
+ IL_002a: stloc.0
+ IL_002b: br.s IL_0040
+
+ IL_002d: ldc.i4.0
+ IL_002e: newobj instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__8'::.ctor(int32)
+ IL_0033: stloc.0
+ IL_0034: ldloc.0
+ IL_0035: ldarg.0
+ IL_0036: ldfld class ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__8'::'<>4__this'
+ IL_003b: stfld class ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__8'::'<>4__this'
+ IL_0040: ldloc.0
+ IL_0041: ldarg.0
+ IL_0042: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__8'::'<>3__p'
+ IL_0047: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__8'::p
+ IL_004c: ldloc.0
+ IL_004d: stloc.1
+ IL_004e: br.s IL_0050
+
+ IL_0050: ldloc.1
+ IL_0051: ret
+ } // end of method 'd__8'::'System.Collections.Generic.IEnumerable.GetEnumerator'
+
+ .method private hidebysig newslot virtual final
+ instance class [mscorlib]System.Collections.IEnumerator
+ System.Collections.IEnumerable.GetEnumerator() cil managed
+ {
+ .custom instance void [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::.ctor() = ( 01 00 00 00 )
+ .override [mscorlib]System.Collections.IEnumerable::GetEnumerator
+ // Code size 11 (0xb)
+ .maxstack 1
+ .locals init (class [mscorlib]System.Collections.IEnumerator V_0)
+ IL_0000: ldarg.0
+ IL_0001: call instance class [mscorlib]System.Collections.Generic.IEnumerator`1 ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__8'::'System.Collections.Generic.IEnumerable.GetEnumerator'()
+ IL_0006: stloc.0
+ IL_0007: br.s IL_0009
+
+ IL_0009: ldloc.0
+ IL_000a: ret
+ } // end of method 'd__8'::System.Collections.IEnumerable.GetEnumerator
+
+ .method private hidebysig newslot virtual final
+ instance bool MoveNext() cil managed
+ {
+ .override [mscorlib]System.Collections.IEnumerator::MoveNext
+ // Code size 115 (0x73)
+ .maxstack 2
+ .locals init (bool V_0,
+ int32 V_1)
+ IL_0000: ldarg.0
+ IL_0001: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__8'::'<>1__state'
+ IL_0006: stloc.1
+ IL_0007: ldloc.1
+ IL_0008: switch (
+ IL_001f,
+ IL_001b,
+ IL_001d)
+ IL_0019: br.s IL_0021
+
+ IL_001b: br.s IL_0042
+
+ IL_001d: br.s IL_0065
+
+ IL_001f: br.s IL_0023
+
+ IL_0021: br.s IL_006d
+
+ IL_0023: ldarg.0
+ IL_0024: ldc.i4.m1
+ IL_0025: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__8'::'<>1__state'
+ IL_002a: nop
+ IL_002b: ldarg.0
+ IL_002c: ldarg.0
+ IL_002d: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__8'::p
+ IL_0032: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__8'::'<>2__current'
+ IL_0037: ldarg.0
+ IL_0038: ldc.i4.1
+ IL_0039: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__8'::'<>1__state'
+ IL_003e: ldc.i4.1
+ IL_003f: stloc.0
+ IL_0040: br.s IL_0071
+
+ IL_0042: ldarg.0
+ IL_0043: ldc.i4.m1
+ IL_0044: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__8'::'<>1__state'
+ IL_0049: ldarg.0
+ IL_004a: ldarg.0
+ IL_004b: ldfld class ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__8'::'<>4__this'
+ IL_0050: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest::fieldOnThis
+ IL_0055: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__8'::'<>2__current'
+ IL_005a: ldarg.0
+ IL_005b: ldc.i4.2
+ IL_005c: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__8'::'<>1__state'
+ IL_0061: ldc.i4.1
+ IL_0062: stloc.0
+ IL_0063: br.s IL_0071
+
+ IL_0065: ldarg.0
+ IL_0066: ldc.i4.m1
+ IL_0067: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__8'::'<>1__state'
+ IL_006c: nop
+ IL_006d: ldc.i4.0
+ IL_006e: stloc.0
+ IL_006f: br.s IL_0071
+
+ IL_0071: ldloc.0
+ IL_0072: ret
+ } // end of method 'd__8'::MoveNext
+
+ .method private hidebysig newslot specialname virtual final
+ instance int32 'System.Collections.Generic.IEnumerator.get_Current'() cil managed
+ {
+ .custom instance void [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::.ctor() = ( 01 00 00 00 )
+ .override method instance !0 class [mscorlib]System.Collections.Generic.IEnumerator`1::get_Current()
+ // Code size 11 (0xb)
+ .maxstack 1
+ .locals init (int32 V_0)
+ IL_0000: ldarg.0
+ IL_0001: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__8'::'<>2__current'
+ IL_0006: stloc.0
+ IL_0007: br.s IL_0009
+
+ IL_0009: ldloc.0
+ IL_000a: ret
+ } // end of method 'd__8'::'System.Collections.Generic.IEnumerator.get_Current'
+
+ .method private hidebysig newslot virtual final
+ instance void System.Collections.IEnumerator.Reset() cil managed
+ {
+ .custom instance void [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::.ctor() = ( 01 00 00 00 )
+ .override [mscorlib]System.Collections.IEnumerator::Reset
+ // Code size 6 (0x6)
+ .maxstack 8
+ IL_0000: newobj instance void [mscorlib]System.NotSupportedException::.ctor()
+ IL_0005: throw
+ } // end of method 'd__8'::System.Collections.IEnumerator.Reset
+
+ .method private hidebysig newslot virtual final
+ instance void System.IDisposable.Dispose() cil managed
+ {
+ .override [mscorlib]System.IDisposable::Dispose
+ // Code size 2 (0x2)
+ .maxstack 8
+ IL_0000: nop
+ IL_0001: ret
+ } // end of method 'd__8'::System.IDisposable.Dispose
+
+ .method private hidebysig newslot specialname virtual final
+ instance object System.Collections.IEnumerator.get_Current() cil managed
+ {
+ .custom instance void [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::.ctor() = ( 01 00 00 00 )
+ .override [mscorlib]System.Collections.IEnumerator::get_Current
+ // Code size 16 (0x10)
+ .maxstack 1
+ .locals init (object V_0)
+ IL_0000: ldarg.0
+ IL_0001: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__8'::'<>2__current'
+ IL_0006: box [mscorlib]System.Int32
+ IL_000b: stloc.0
+ IL_000c: br.s IL_000e
+
+ IL_000e: ldloc.0
+ IL_000f: ret
+ } // end of method 'd__8'::System.Collections.IEnumerator.get_Current
+
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor(int32 '<>1__state') cil managed
+ {
+ .custom instance void [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::.ctor() = ( 01 00 00 00 )
+ // Code size 25 (0x19)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ldarg.0
+ IL_0007: ldarg.1
+ IL_0008: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__8'::'<>1__state'
+ IL_000d: ldarg.0
+ IL_000e: call int32 [mscorlib]System.Environment::get_CurrentManagedThreadId()
+ IL_0013: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__8'::'<>l__initialThreadId'
+ IL_0018: ret
+ } // end of method 'd__8'::.ctor
+
+ .property instance int32 'System.Collections.Generic.IEnumerator.Current'()
+ {
+ .get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__8'::'System.Collections.Generic.IEnumerator.get_Current'()
+ } // end of property 'd__8'::'System.Collections.Generic.IEnumerator.Current'
+ .property instance object System.Collections.IEnumerator.Current()
+ {
+ .get instance object ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__8'::System.Collections.IEnumerator.get_Current()
+ } // end of property 'd__8'::System.Collections.IEnumerator.Current
+ } // end of class 'd__8'
+
+ .class auto ansi sealed nested private beforefieldinit 'd__b'
+ extends [mscorlib]System.Object
+ implements class [mscorlib]System.Collections.Generic.IEnumerator`1,
+ [mscorlib]System.Collections.IEnumerator,
+ [mscorlib]System.IDisposable
+ {
+ .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
+ .field private int32 '<>2__current'
+ .field private int32 '<>1__state'
+ .field public class ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest '<>4__this'
+ .field public int32 p
+ .method private hidebysig newslot virtual final
+ instance bool MoveNext() cil managed
+ {
+ .override [mscorlib]System.Collections.IEnumerator::MoveNext
+ // Code size 115 (0x73)
+ .maxstack 2
+ .locals init (bool V_0,
+ int32 V_1)
+ IL_0000: ldarg.0
+ IL_0001: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__b'::'<>1__state'
+ IL_0006: stloc.1
+ IL_0007: ldloc.1
+ IL_0008: switch (
+ IL_001f,
+ IL_001b,
+ IL_001d)
+ IL_0019: br.s IL_0021
+
+ IL_001b: br.s IL_0042
+
+ IL_001d: br.s IL_0065
+
+ IL_001f: br.s IL_0023
+
+ IL_0021: br.s IL_006d
+
+ IL_0023: ldarg.0
+ IL_0024: ldc.i4.m1
+ IL_0025: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__b'::'<>1__state'
+ IL_002a: nop
+ IL_002b: ldarg.0
+ IL_002c: ldarg.0
+ IL_002d: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__b'::p
+ IL_0032: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__b'::'<>2__current'
+ IL_0037: ldarg.0
+ IL_0038: ldc.i4.1
+ IL_0039: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__b'::'<>1__state'
+ IL_003e: ldc.i4.1
+ IL_003f: stloc.0
+ IL_0040: br.s IL_0071
+
+ IL_0042: ldarg.0
+ IL_0043: ldc.i4.m1
+ IL_0044: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__b'::'<>1__state'
+ IL_0049: ldarg.0
+ IL_004a: ldarg.0
+ IL_004b: ldfld class ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__b'::'<>4__this'
+ IL_0050: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest::fieldOnThis
+ IL_0055: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__b'::'<>2__current'
+ IL_005a: ldarg.0
+ IL_005b: ldc.i4.2
+ IL_005c: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__b'::'<>1__state'
+ IL_0061: ldc.i4.1
+ IL_0062: stloc.0
+ IL_0063: br.s IL_0071
+
+ IL_0065: ldarg.0
+ IL_0066: ldc.i4.m1
+ IL_0067: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__b'::'<>1__state'
+ IL_006c: nop
+ IL_006d: ldc.i4.0
+ IL_006e: stloc.0
+ IL_006f: br.s IL_0071
+
+ IL_0071: ldloc.0
+ IL_0072: ret
+ } // end of method 'd__b'::MoveNext
+
+ .method private hidebysig newslot specialname virtual final
+ instance int32 'System.Collections.Generic.IEnumerator.get_Current'() cil managed
+ {
+ .custom instance void [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::.ctor() = ( 01 00 00 00 )
+ .override method instance !0 class [mscorlib]System.Collections.Generic.IEnumerator`1::get_Current()
+ // Code size 11 (0xb)
+ .maxstack 1
+ .locals init (int32 V_0)
+ IL_0000: ldarg.0
+ IL_0001: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__b'::'<>2__current'
+ IL_0006: stloc.0
+ IL_0007: br.s IL_0009
+
+ IL_0009: ldloc.0
+ IL_000a: ret
+ } // end of method 'd__b'::'System.Collections.Generic.IEnumerator.get_Current'
+
+ .method private hidebysig newslot virtual final
+ instance void System.Collections.IEnumerator.Reset() cil managed
+ {
+ .custom instance void [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::.ctor() = ( 01 00 00 00 )
+ .override [mscorlib]System.Collections.IEnumerator::Reset
+ // Code size 6 (0x6)
+ .maxstack 8
+ IL_0000: newobj instance void [mscorlib]System.NotSupportedException::.ctor()
+ IL_0005: throw
+ } // end of method 'd__b'::System.Collections.IEnumerator.Reset
+
+ .method private hidebysig newslot virtual final
+ instance void System.IDisposable.Dispose() cil managed
+ {
+ .override [mscorlib]System.IDisposable::Dispose
+ // Code size 2 (0x2)
+ .maxstack 8
+ IL_0000: nop
+ IL_0001: ret
+ } // end of method 'd__b'::System.IDisposable.Dispose
+
+ .method private hidebysig newslot specialname virtual final
+ instance object System.Collections.IEnumerator.get_Current() cil managed
+ {
+ .custom instance void [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::.ctor() = ( 01 00 00 00 )
+ .override [mscorlib]System.Collections.IEnumerator::get_Current
+ // Code size 16 (0x10)
+ .maxstack 1
+ .locals init (object V_0)
+ IL_0000: ldarg.0
+ IL_0001: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__b'::'<>2__current'
+ IL_0006: box [mscorlib]System.Int32
+ IL_000b: stloc.0
+ IL_000c: br.s IL_000e
+
+ IL_000e: ldloc.0
+ IL_000f: ret
+ } // end of method 'd__b'::System.Collections.IEnumerator.get_Current
+
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor(int32 '<>1__state') cil managed
+ {
+ .custom instance void [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::.ctor() = ( 01 00 00 00 )
+ // Code size 14 (0xe)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ldarg.0
+ IL_0007: ldarg.1
+ IL_0008: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__b'::'<>1__state'
+ IL_000d: ret
+ } // end of method 'd__b'::.ctor
+
+ .property instance int32 'System.Collections.Generic.IEnumerator.Current'()
+ {
+ .get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'d__b'::'System.Collections.Generic.IEnumerator.get_Current'()
+ } // end of property 'd__b'::'System.Collections.Generic.IEnumerator.Current'
+ .property instance object System.Collections.IEnumerator.Current()
+ {
+ .get instance object ICSharpCode.Decompiler.Tests.TestCases.Pretty.YieldReturnPrettyTest/'