未验证 提交 eea11615 编写于 作者: C Charles Stoner 提交者: GitHub

Avoid optimizing goto in SyntheticBoundNodeFactory.Switch() (#34791)

上级 59e21bf2
......@@ -884,18 +884,9 @@ public BoundStatement Switch(BoundExpression ex, ImmutableArray<SyntheticSwitchS
statements.Add(null); // placeholder at statements[0] for the dispatch
foreach (var section in sections)
{
LabelSymbol sectionLabel;
// If the section only contains a goto statement, use that label.
if (section.Statements.Length == 1 && section.Statements[0] is BoundGotoStatement bgoto)
{
sectionLabel = bgoto.Label;
}
else
{
sectionLabel = new GeneratedLabelSymbol("case " + section.Values[0]);
statements.Add(Label(sectionLabel));
statements.AddRange(section.Statements);
}
LabelSymbol sectionLabel = new GeneratedLabelSymbol("case " + section.Values[0]);
statements.Add(Label(sectionLabel));
statements.AddRange(section.Statements);
foreach (var value in section.Values)
{
......
......@@ -3,8 +3,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using Microsoft.CodeAnalysis.CSharp.Symbols;
using Microsoft.CodeAnalysis.CSharp.Test.Utilities;
using Microsoft.CodeAnalysis.Test.Utilities;
using Roslyn.Test.Utilities;
......@@ -896,7 +894,6 @@ public static void Main()
CompileAndVerify(source, expectedOutput: expected);
}
[ConditionalFact(typeof(WindowsOnly), Reason = ConditionalSkipReason.NativePdbRequiresDesktop)]
public void AsyncInFinally003()
{
......@@ -978,9 +975,9 @@ public static void Main()
</symbols>
");
v.VerifyIL("Test.<G>d__1.System.Runtime.CompilerServices.IAsyncStateMachine.MoveNext", @"
{
// Code size 455 (0x1c7)
v.VerifyIL("Test.<G>d__1.System.Runtime.CompilerServices.IAsyncStateMachine.MoveNext",
@"{
// Code size 461 (0x1cd)
.maxstack 3
.locals init (int V_0,
int V_1,
......@@ -996,194 +993,197 @@ .maxstack 3
.try
{
~IL_0007: ldloc.0
IL_0008: brfalse.s IL_002b
IL_0008: brfalse.s IL_0012
IL_000a: br.s IL_000c
IL_000c: ldloc.0
IL_000d: ldc.i4.1
IL_000e: beq IL_010f
IL_0013: br.s IL_0015
-IL_0015: nop
-IL_0016: ldarg.0
IL_0017: ldc.i4.0
IL_0018: stfld ""int Test.<G>d__1.<x>5__1""
~IL_001d: ldarg.0
IL_001e: ldnull
IL_001f: stfld ""object Test.<G>d__1.<>s__2""
IL_0024: ldarg.0
IL_0025: ldc.i4.0
IL_0026: stfld ""int Test.<G>d__1.<>s__3""
~IL_002b: nop
IL_000e: beq.s IL_0014
IL_0010: br.s IL_0019
IL_0012: br.s IL_002f
IL_0014: br IL_0115
-IL_0019: nop
-IL_001a: ldarg.0
IL_001b: ldc.i4.0
IL_001c: stfld ""int Test.<G>d__1.<x>5__1""
~IL_0021: ldarg.0
IL_0022: ldnull
IL_0023: stfld ""object Test.<G>d__1.<>s__2""
IL_0028: ldarg.0
IL_0029: ldc.i4.0
IL_002a: stfld ""int Test.<G>d__1.<>s__3""
~IL_002f: nop
.try
{
~IL_002c: ldloc.0
IL_002d: brfalse.s IL_006d
IL_002f: br.s IL_0031
-IL_0031: nop
-IL_0032: call ""System.Threading.Tasks.Task<int> Test.F()""
IL_0037: callvirt ""System.Runtime.CompilerServices.TaskAwaiter<int> System.Threading.Tasks.Task<int>.GetAwaiter()""
IL_003c: stloc.2
~IL_003d: ldloca.s V_2
IL_003f: call ""bool System.Runtime.CompilerServices.TaskAwaiter<int>.IsCompleted.get""
IL_0044: brtrue.s IL_0089
IL_0046: ldarg.0
IL_0047: ldc.i4.0
IL_0048: dup
IL_0049: stloc.0
IL_004a: stfld ""int Test.<G>d__1.<>1__state""
<IL_004f: ldarg.0
IL_0050: ldloc.2
IL_0051: stfld ""System.Runtime.CompilerServices.TaskAwaiter<int> Test.<G>d__1.<>u__1""
IL_0056: ldarg.0
IL_0057: stloc.3
IL_0058: ldarg.0
IL_0059: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<G>d__1.<>t__builder""
IL_005e: ldloca.s V_2
IL_0060: ldloca.s V_3
IL_0062: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.AwaitUnsafeOnCompleted<System.Runtime.CompilerServices.TaskAwaiter<int>, Test.<G>d__1>(ref System.Runtime.CompilerServices.TaskAwaiter<int>, ref Test.<G>d__1)""
IL_0067: nop
IL_0068: leave IL_01c6
>IL_006d: ldarg.0
IL_006e: ldfld ""System.Runtime.CompilerServices.TaskAwaiter<int> Test.<G>d__1.<>u__1""
IL_0073: stloc.2
IL_0074: ldarg.0
IL_0075: ldflda ""System.Runtime.CompilerServices.TaskAwaiter<int> Test.<G>d__1.<>u__1""
IL_007a: initobj ""System.Runtime.CompilerServices.TaskAwaiter<int>""
IL_0080: ldarg.0
IL_0081: ldc.i4.m1
IL_0082: dup
IL_0083: stloc.0
IL_0084: stfld ""int Test.<G>d__1.<>1__state""
IL_0089: ldarg.0
IL_008a: ldloca.s V_2
IL_008c: call ""int System.Runtime.CompilerServices.TaskAwaiter<int>.GetResult()""
IL_0091: stfld ""int Test.<G>d__1.<>s__5""
IL_0096: ldarg.0
IL_0097: ldarg.0
IL_0098: ldfld ""int Test.<G>d__1.<>s__5""
IL_009d: stfld ""int Test.<G>d__1.<x>5__1""
-IL_00a2: ldarg.0
IL_00a3: ldarg.0
IL_00a4: ldfld ""int Test.<G>d__1.<x>5__1""
IL_00a9: stfld ""int Test.<G>d__1.<>s__4""
IL_00ae: br.s IL_00b0
IL_00b0: ldarg.0
IL_00b1: ldc.i4.1
IL_00b2: stfld ""int Test.<G>d__1.<>s__3""
IL_00b7: leave.s IL_00c5
~IL_0030: ldloc.0
IL_0031: brfalse.s IL_0035
IL_0033: br.s IL_0037
IL_0035: br.s IL_0073
-IL_0037: nop
-IL_0038: call ""System.Threading.Tasks.Task<int> Test.F()""
IL_003d: callvirt ""System.Runtime.CompilerServices.TaskAwaiter<int> System.Threading.Tasks.Task<int>.GetAwaiter()""
IL_0042: stloc.2
~IL_0043: ldloca.s V_2
IL_0045: call ""bool System.Runtime.CompilerServices.TaskAwaiter<int>.IsCompleted.get""
IL_004a: brtrue.s IL_008f
IL_004c: ldarg.0
IL_004d: ldc.i4.0
IL_004e: dup
IL_004f: stloc.0
IL_0050: stfld ""int Test.<G>d__1.<>1__state""
<IL_0055: ldarg.0
IL_0056: ldloc.2
IL_0057: stfld ""System.Runtime.CompilerServices.TaskAwaiter<int> Test.<G>d__1.<>u__1""
IL_005c: ldarg.0
IL_005d: stloc.3
IL_005e: ldarg.0
IL_005f: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<G>d__1.<>t__builder""
IL_0064: ldloca.s V_2
IL_0066: ldloca.s V_3
IL_0068: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.AwaitUnsafeOnCompleted<System.Runtime.CompilerServices.TaskAwaiter<int>, Test.<G>d__1>(ref System.Runtime.CompilerServices.TaskAwaiter<int>, ref Test.<G>d__1)""
IL_006d: nop
IL_006e: leave IL_01cc
>IL_0073: ldarg.0
IL_0074: ldfld ""System.Runtime.CompilerServices.TaskAwaiter<int> Test.<G>d__1.<>u__1""
IL_0079: stloc.2
IL_007a: ldarg.0
IL_007b: ldflda ""System.Runtime.CompilerServices.TaskAwaiter<int> Test.<G>d__1.<>u__1""
IL_0080: initobj ""System.Runtime.CompilerServices.TaskAwaiter<int>""
IL_0086: ldarg.0
IL_0087: ldc.i4.m1
IL_0088: dup
IL_0089: stloc.0
IL_008a: stfld ""int Test.<G>d__1.<>1__state""
IL_008f: ldarg.0
IL_0090: ldloca.s V_2
IL_0092: call ""int System.Runtime.CompilerServices.TaskAwaiter<int>.GetResult()""
IL_0097: stfld ""int Test.<G>d__1.<>s__5""
IL_009c: ldarg.0
IL_009d: ldarg.0
IL_009e: ldfld ""int Test.<G>d__1.<>s__5""
IL_00a3: stfld ""int Test.<G>d__1.<x>5__1""
-IL_00a8: ldarg.0
IL_00a9: ldarg.0
IL_00aa: ldfld ""int Test.<G>d__1.<x>5__1""
IL_00af: stfld ""int Test.<G>d__1.<>s__4""
IL_00b4: br.s IL_00b6
IL_00b6: ldarg.0
IL_00b7: ldc.i4.1
IL_00b8: stfld ""int Test.<G>d__1.<>s__3""
IL_00bd: leave.s IL_00cb
}
catch object
{
~IL_00b9: stloc.s V_4
IL_00bb: ldarg.0
IL_00bc: ldloc.s V_4
IL_00be: stfld ""object Test.<G>d__1.<>s__2""
IL_00c3: leave.s IL_00c5
}
-IL_00c5: nop
-IL_00c6: ldarg.0
IL_00c7: ldarg.0
IL_00c8: ldfld ""int Test.<G>d__1.<x>5__1""
IL_00cd: stfld ""int Test.<G>d__1.<>s__6""
IL_00d2: call ""System.Threading.Tasks.Task<int> Test.F()""
IL_00d7: callvirt ""System.Runtime.CompilerServices.TaskAwaiter<int> System.Threading.Tasks.Task<int>.GetAwaiter()""
IL_00dc: stloc.s V_5
~IL_00de: ldloca.s V_5
IL_00e0: call ""bool System.Runtime.CompilerServices.TaskAwaiter<int>.IsCompleted.get""
IL_00e5: brtrue.s IL_012c
IL_00e7: ldarg.0
IL_00e8: ldc.i4.1
IL_00e9: dup
IL_00ea: stloc.0
IL_00eb: stfld ""int Test.<G>d__1.<>1__state""
<IL_00f0: ldarg.0
IL_00f1: ldloc.s V_5
IL_00f3: stfld ""System.Runtime.CompilerServices.TaskAwaiter<int> Test.<G>d__1.<>u__1""
IL_00f8: ldarg.0
IL_00f9: stloc.3
IL_00fa: ldarg.0
IL_00fb: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<G>d__1.<>t__builder""
IL_0100: ldloca.s V_5
IL_0102: ldloca.s V_3
IL_0104: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.AwaitUnsafeOnCompleted<System.Runtime.CompilerServices.TaskAwaiter<int>, Test.<G>d__1>(ref System.Runtime.CompilerServices.TaskAwaiter<int>, ref Test.<G>d__1)""
IL_0109: nop
IL_010a: leave IL_01c6
>IL_010f: ldarg.0
IL_0110: ldfld ""System.Runtime.CompilerServices.TaskAwaiter<int> Test.<G>d__1.<>u__1""
IL_0115: stloc.s V_5
IL_0117: ldarg.0
IL_0118: ldflda ""System.Runtime.CompilerServices.TaskAwaiter<int> Test.<G>d__1.<>u__1""
IL_011d: initobj ""System.Runtime.CompilerServices.TaskAwaiter<int>""
IL_0123: ldarg.0
IL_0124: ldc.i4.m1
IL_0125: dup
IL_0126: stloc.0
IL_0127: stfld ""int Test.<G>d__1.<>1__state""
IL_012c: ldarg.0
IL_012d: ldloca.s V_5
IL_012f: call ""int System.Runtime.CompilerServices.TaskAwaiter<int>.GetResult()""
IL_0134: stfld ""int Test.<G>d__1.<>s__7""
IL_0139: ldarg.0
IL_013a: ldarg.0
IL_013b: ldfld ""int Test.<G>d__1.<>s__6""
~IL_00bf: stloc.s V_4
IL_00c1: ldarg.0
IL_00c2: ldloc.s V_4
IL_00c4: stfld ""object Test.<G>d__1.<>s__2""
IL_00c9: leave.s IL_00cb
}
-IL_00cb: nop
-IL_00cc: ldarg.0
IL_00cd: ldarg.0
IL_00ce: ldfld ""int Test.<G>d__1.<x>5__1""
IL_00d3: stfld ""int Test.<G>d__1.<>s__6""
IL_00d8: call ""System.Threading.Tasks.Task<int> Test.F()""
IL_00dd: callvirt ""System.Runtime.CompilerServices.TaskAwaiter<int> System.Threading.Tasks.Task<int>.GetAwaiter()""
IL_00e2: stloc.s V_5
~IL_00e4: ldloca.s V_5
IL_00e6: call ""bool System.Runtime.CompilerServices.TaskAwaiter<int>.IsCompleted.get""
IL_00eb: brtrue.s IL_0132
IL_00ed: ldarg.0
IL_00ee: ldc.i4.1
IL_00ef: dup
IL_00f0: stloc.0
IL_00f1: stfld ""int Test.<G>d__1.<>1__state""
<IL_00f6: ldarg.0
IL_00f7: ldloc.s V_5
IL_00f9: stfld ""System.Runtime.CompilerServices.TaskAwaiter<int> Test.<G>d__1.<>u__1""
IL_00fe: ldarg.0
IL_00ff: stloc.3
IL_0100: ldarg.0
IL_0101: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<G>d__1.<>t__builder""
IL_0106: ldloca.s V_5
IL_0108: ldloca.s V_3
IL_010a: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.AwaitUnsafeOnCompleted<System.Runtime.CompilerServices.TaskAwaiter<int>, Test.<G>d__1>(ref System.Runtime.CompilerServices.TaskAwaiter<int>, ref Test.<G>d__1)""
IL_010f: nop
IL_0110: leave IL_01cc
>IL_0115: ldarg.0
IL_0116: ldfld ""System.Runtime.CompilerServices.TaskAwaiter<int> Test.<G>d__1.<>u__1""
IL_011b: stloc.s V_5
IL_011d: ldarg.0
IL_011e: ldflda ""System.Runtime.CompilerServices.TaskAwaiter<int> Test.<G>d__1.<>u__1""
IL_0123: initobj ""System.Runtime.CompilerServices.TaskAwaiter<int>""
IL_0129: ldarg.0
IL_012a: ldc.i4.m1
IL_012b: dup
IL_012c: stloc.0
IL_012d: stfld ""int Test.<G>d__1.<>1__state""
IL_0132: ldarg.0
IL_0133: ldloca.s V_5
IL_0135: call ""int System.Runtime.CompilerServices.TaskAwaiter<int>.GetResult()""
IL_013a: stfld ""int Test.<G>d__1.<>s__7""
IL_013f: ldarg.0
IL_0140: ldarg.0
IL_0141: ldfld ""int Test.<G>d__1.<>s__7""
IL_0146: add
IL_0147: stfld ""int Test.<G>d__1.<x>5__1""
-IL_014c: nop
~IL_014d: ldarg.0
IL_014e: ldfld ""object Test.<G>d__1.<>s__2""
IL_0153: stloc.s V_4
IL_0155: ldloc.s V_4
IL_0157: brfalse.s IL_0176
IL_0159: ldloc.s V_4
IL_015b: isinst ""System.Exception""
IL_0160: stloc.s V_6
IL_0162: ldloc.s V_6
IL_0164: brtrue.s IL_0169
IL_0166: ldloc.s V_4
IL_0168: throw
IL_0169: ldloc.s V_6
IL_016b: call ""System.Runtime.ExceptionServices.ExceptionDispatchInfo System.Runtime.ExceptionServices.ExceptionDispatchInfo.Capture(System.Exception)""
IL_0170: callvirt ""void System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()""
IL_0175: nop
IL_0176: ldarg.0
IL_0177: ldfld ""int Test.<G>d__1.<>s__3""
IL_017c: stloc.s V_7
IL_017e: ldloc.s V_7
IL_0180: ldc.i4.1
IL_0181: beq.s IL_0185
IL_0183: br.s IL_018e
IL_0185: ldarg.0
IL_0186: ldfld ""int Test.<G>d__1.<>s__4""
IL_018b: stloc.1
IL_018c: leave.s IL_01b1
IL_018e: ldarg.0
IL_018f: ldnull
IL_0190: stfld ""object Test.<G>d__1.<>s__2""
IL_0195: leave.s IL_01b1
IL_0141: ldfld ""int Test.<G>d__1.<>s__6""
IL_0146: ldarg.0
IL_0147: ldfld ""int Test.<G>d__1.<>s__7""
IL_014c: add
IL_014d: stfld ""int Test.<G>d__1.<x>5__1""
-IL_0152: nop
~IL_0153: ldarg.0
IL_0154: ldfld ""object Test.<G>d__1.<>s__2""
IL_0159: stloc.s V_4
IL_015b: ldloc.s V_4
IL_015d: brfalse.s IL_017c
IL_015f: ldloc.s V_4
IL_0161: isinst ""System.Exception""
IL_0166: stloc.s V_6
IL_0168: ldloc.s V_6
IL_016a: brtrue.s IL_016f
IL_016c: ldloc.s V_4
IL_016e: throw
IL_016f: ldloc.s V_6
IL_0171: call ""System.Runtime.ExceptionServices.ExceptionDispatchInfo System.Runtime.ExceptionServices.ExceptionDispatchInfo.Capture(System.Exception)""
IL_0176: callvirt ""void System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()""
IL_017b: nop
IL_017c: ldarg.0
IL_017d: ldfld ""int Test.<G>d__1.<>s__3""
IL_0182: stloc.s V_7
IL_0184: ldloc.s V_7
IL_0186: ldc.i4.1
IL_0187: beq.s IL_018b
IL_0189: br.s IL_0194
IL_018b: ldarg.0
IL_018c: ldfld ""int Test.<G>d__1.<>s__4""
IL_0191: stloc.1
IL_0192: leave.s IL_01b7
IL_0194: ldarg.0
IL_0195: ldnull
IL_0196: stfld ""object Test.<G>d__1.<>s__2""
IL_019b: leave.s IL_01b7
}
catch System.Exception
{
~IL_0197: stloc.s V_6
IL_0199: ldarg.0
IL_019a: ldc.i4.s -2
IL_019c: stfld ""int Test.<G>d__1.<>1__state""
IL_01a1: ldarg.0
IL_01a2: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<G>d__1.<>t__builder""
IL_01a7: ldloc.s V_6
IL_01a9: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.SetException(System.Exception)""
IL_01ae: nop
IL_01af: leave.s IL_01c6
~IL_019d: stloc.s V_6
IL_019f: ldarg.0
IL_01a0: ldc.i4.s -2
IL_01a2: stfld ""int Test.<G>d__1.<>1__state""
IL_01a7: ldarg.0
IL_01a8: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<G>d__1.<>t__builder""
IL_01ad: ldloc.s V_6
IL_01af: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.SetException(System.Exception)""
IL_01b4: nop
IL_01b5: leave.s IL_01cc
}
-IL_01b1: ldarg.0
IL_01b2: ldc.i4.s -2
IL_01b4: stfld ""int Test.<G>d__1.<>1__state""
~IL_01b9: ldarg.0
IL_01ba: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<G>d__1.<>t__builder""
IL_01bf: ldloc.1
IL_01c0: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.SetResult(int)""
IL_01c5: nop
IL_01c6: ret
-IL_01b7: ldarg.0
IL_01b8: ldc.i4.s -2
IL_01ba: stfld ""int Test.<G>d__1.<>1__state""
~IL_01bf: ldarg.0
IL_01c0: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<G>d__1.<>t__builder""
IL_01c5: ldloc.1
IL_01c6: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.SetResult(int)""
IL_01cb: nop
IL_01cc: ret
}", sequencePoints: "Test+<G>d__1.MoveNext");
}
......@@ -1786,7 +1786,6 @@ public static void Main()
CompileAndVerify(source, expectedOutput: expected);
}
[Fact]
public void AsyncInCatchFilter()
{
......
......@@ -2054,9 +2054,9 @@ .maxstack 5
}");
if (options == TestOptions.DebugExe)
{
verifier.VerifyIL("C.<M>d__0.System.Runtime.CompilerServices.IAsyncStateMachine.MoveNext()", @"
{
// Code size 289 (0x121)
verifier.VerifyIL("C.<M>d__0.System.Runtime.CompilerServices.IAsyncStateMachine.MoveNext()",
@"{
// Code size 298 (0x12a)
.maxstack 3
.locals init (int V_0,
System.Runtime.CompilerServices.TaskAwaiter V_1,
......@@ -2073,131 +2073,133 @@ .maxstack 3
IL_0008: ldc.i4.s -4
IL_000a: sub
IL_000b: switch (
IL_00c5,
IL_0026,
IL_0026,
IL_0026,
IL_0083)
IL_0024: br.s IL_0026
IL_0026: ldarg.0
IL_0027: ldfld ""bool C.<M>d__0.<>w__disposeMode""
IL_002c: brfalse.s IL_0033
IL_002e: leave IL_00fd
IL_0033: ldarg.0
IL_0034: ldc.i4.m1
IL_0035: dup
IL_0036: stloc.0
IL_0037: stfld ""int C.<M>d__0.<>1__state""
IL_002b,
IL_002f,
IL_002f,
IL_002d)
IL_0024: br.s IL_002f
IL_0026: br IL_00ce
IL_002b: br.s IL_002f
IL_002d: br.s IL_008c
IL_002f: ldarg.0
IL_0030: ldfld ""bool C.<M>d__0.<>w__disposeMode""
IL_0035: brfalse.s IL_003c
IL_0037: leave IL_0106
IL_003c: ldarg.0
IL_003d: ldc.i4.m1
IL_003e: dup
IL_003f: stloc.0
IL_0040: stfld ""int C.<M>d__0.<>1__state""
// sequence point: {
IL_003c: nop
IL_0045: nop
// sequence point: Write(""1 "");
IL_003d: ldstr ""1 ""
IL_0042: call ""void System.Console.Write(string)""
IL_0047: nop
IL_0046: ldstr ""1 ""
IL_004b: call ""void System.Console.Write(string)""
IL_0050: nop
// sequence point: await System.Threading.Tasks.Task.CompletedTask;
IL_0048: call ""System.Threading.Tasks.Task System.Threading.Tasks.Task.CompletedTask.get""
IL_004d: callvirt ""System.Runtime.CompilerServices.TaskAwaiter System.Threading.Tasks.Task.GetAwaiter()""
IL_0052: stloc.1
IL_0051: call ""System.Threading.Tasks.Task System.Threading.Tasks.Task.CompletedTask.get""
IL_0056: callvirt ""System.Runtime.CompilerServices.TaskAwaiter System.Threading.Tasks.Task.GetAwaiter()""
IL_005b: stloc.1
// sequence point: <hidden>
IL_0053: ldloca.s V_1
IL_0055: call ""bool System.Runtime.CompilerServices.TaskAwaiter.IsCompleted.get""
IL_005a: brtrue.s IL_009f
IL_005c: ldarg.0
IL_005d: ldc.i4.0
IL_005e: dup
IL_005f: stloc.0
IL_0060: stfld ""int C.<M>d__0.<>1__state""
// async: yield
IL_005c: ldloca.s V_1
IL_005e: call ""bool System.Runtime.CompilerServices.TaskAwaiter.IsCompleted.get""
IL_0063: brtrue.s IL_00a8
IL_0065: ldarg.0
IL_0066: ldloc.1
IL_0067: stfld ""System.Runtime.CompilerServices.TaskAwaiter C.<M>d__0.<>u__1""
IL_006c: ldarg.0
IL_006d: stloc.2
IL_0066: ldc.i4.0
IL_0067: dup
IL_0068: stloc.0
IL_0069: stfld ""int C.<M>d__0.<>1__state""
// async: yield
IL_006e: ldarg.0
IL_006f: ldflda ""System.Runtime.CompilerServices.AsyncIteratorMethodBuilder C.<M>d__0.<>t__builder""
IL_0074: ldloca.s V_1
IL_0076: ldloca.s V_2
IL_0078: call ""void System.Runtime.CompilerServices.AsyncIteratorMethodBuilder.AwaitUnsafeOnCompleted<System.Runtime.CompilerServices.TaskAwaiter, C.<M>d__0>(ref System.Runtime.CompilerServices.TaskAwaiter, ref C.<M>d__0)""
IL_007d: nop
IL_007e: leave IL_0120
IL_006f: ldloc.1
IL_0070: stfld ""System.Runtime.CompilerServices.TaskAwaiter C.<M>d__0.<>u__1""
IL_0075: ldarg.0
IL_0076: stloc.2
IL_0077: ldarg.0
IL_0078: ldflda ""System.Runtime.CompilerServices.AsyncIteratorMethodBuilder C.<M>d__0.<>t__builder""
IL_007d: ldloca.s V_1
IL_007f: ldloca.s V_2
IL_0081: call ""void System.Runtime.CompilerServices.AsyncIteratorMethodBuilder.AwaitUnsafeOnCompleted<System.Runtime.CompilerServices.TaskAwaiter, C.<M>d__0>(ref System.Runtime.CompilerServices.TaskAwaiter, ref C.<M>d__0)""
IL_0086: nop
IL_0087: leave IL_0129
// async: resume
IL_0083: ldarg.0
IL_0084: ldfld ""System.Runtime.CompilerServices.TaskAwaiter C.<M>d__0.<>u__1""
IL_0089: stloc.1
IL_008a: ldarg.0
IL_008b: ldflda ""System.Runtime.CompilerServices.TaskAwaiter C.<M>d__0.<>u__1""
IL_0090: initobj ""System.Runtime.CompilerServices.TaskAwaiter""
IL_0096: ldarg.0
IL_0097: ldc.i4.m1
IL_0098: dup
IL_0099: stloc.0
IL_009a: stfld ""int C.<M>d__0.<>1__state""
IL_009f: ldloca.s V_1
IL_00a1: call ""void System.Runtime.CompilerServices.TaskAwaiter.GetResult()""
IL_00a6: nop
IL_008c: ldarg.0
IL_008d: ldfld ""System.Runtime.CompilerServices.TaskAwaiter C.<M>d__0.<>u__1""
IL_0092: stloc.1
IL_0093: ldarg.0
IL_0094: ldflda ""System.Runtime.CompilerServices.TaskAwaiter C.<M>d__0.<>u__1""
IL_0099: initobj ""System.Runtime.CompilerServices.TaskAwaiter""
IL_009f: ldarg.0
IL_00a0: ldc.i4.m1
IL_00a1: dup
IL_00a2: stloc.0
IL_00a3: stfld ""int C.<M>d__0.<>1__state""
IL_00a8: ldloca.s V_1
IL_00aa: call ""void System.Runtime.CompilerServices.TaskAwaiter.GetResult()""
IL_00af: nop
// sequence point: Write(""2 "");
IL_00a7: ldstr ""2 ""
IL_00ac: call ""void System.Console.Write(string)""
IL_00b1: nop
IL_00b0: ldstr ""2 ""
IL_00b5: call ""void System.Console.Write(string)""
IL_00ba: nop
// sequence point: yield return 3;
IL_00b2: ldarg.0
IL_00b3: ldc.i4.3
IL_00b4: stfld ""int C.<M>d__0.<>2__current""
IL_00b9: ldarg.0
IL_00ba: ldc.i4.s -4
IL_00bc: dup
IL_00bd: stloc.0
IL_00be: stfld ""int C.<M>d__0.<>1__state""
IL_00c3: leave.s IL_0113
IL_00bb: ldarg.0
IL_00bc: ldc.i4.3
IL_00bd: stfld ""int C.<M>d__0.<>2__current""
IL_00c2: ldarg.0
IL_00c3: ldc.i4.s -4
IL_00c5: dup
IL_00c6: stloc.0
IL_00c7: stfld ""int C.<M>d__0.<>1__state""
IL_00cc: leave.s IL_011c
// sequence point: <hidden>
IL_00c5: ldarg.0
IL_00c6: ldc.i4.m1
IL_00c7: dup
IL_00c8: stloc.0
IL_00c9: stfld ""int C.<M>d__0.<>1__state""
IL_00ce: ldarg.0
IL_00cf: ldfld ""bool C.<M>d__0.<>w__disposeMode""
IL_00d4: brfalse.s IL_00d8
IL_00d6: leave.s IL_00fd
IL_00cf: ldc.i4.m1
IL_00d0: dup
IL_00d1: stloc.0
IL_00d2: stfld ""int C.<M>d__0.<>1__state""
IL_00d7: ldarg.0
IL_00d8: ldfld ""bool C.<M>d__0.<>w__disposeMode""
IL_00dd: brfalse.s IL_00e1
IL_00df: leave.s IL_0106
// sequence point: Write("" 4 "");
IL_00d8: ldstr "" 4 ""
IL_00dd: call ""void System.Console.Write(string)""
IL_00e2: nop
IL_00e3: leave.s IL_00fd
IL_00e1: ldstr "" 4 ""
IL_00e6: call ""void System.Console.Write(string)""
IL_00eb: nop
IL_00ec: leave.s IL_0106
}
catch System.Exception
{
// sequence point: <hidden>
IL_00e5: stloc.3
IL_00e6: ldarg.0
IL_00e7: ldc.i4.s -2
IL_00e9: stfld ""int C.<M>d__0.<>1__state""
IL_00ee: ldarg.0
IL_00ef: ldflda ""System.Threading.Tasks.Sources.ManualResetValueTaskSourceCore<bool> C.<M>d__0.<>v__promiseOfValueOrEnd""
IL_00f4: ldloc.3
IL_00f5: call ""void System.Threading.Tasks.Sources.ManualResetValueTaskSourceCore<bool>.SetException(System.Exception)""
IL_00fa: nop
IL_00fb: leave.s IL_0120
IL_00ee: stloc.3
IL_00ef: ldarg.0
IL_00f0: ldc.i4.s -2
IL_00f2: stfld ""int C.<M>d__0.<>1__state""
IL_00f7: ldarg.0
IL_00f8: ldflda ""System.Threading.Tasks.Sources.ManualResetValueTaskSourceCore<bool> C.<M>d__0.<>v__promiseOfValueOrEnd""
IL_00fd: ldloc.3
IL_00fe: call ""void System.Threading.Tasks.Sources.ManualResetValueTaskSourceCore<bool>.SetException(System.Exception)""
IL_0103: nop
IL_0104: leave.s IL_0129
}
// sequence point: }
IL_00fd: ldarg.0
IL_00fe: ldc.i4.s -2
IL_0100: stfld ""int C.<M>d__0.<>1__state""
IL_0106: ldarg.0
IL_0107: ldc.i4.s -2
IL_0109: stfld ""int C.<M>d__0.<>1__state""
// sequence point: <hidden>
IL_0105: ldarg.0
IL_0106: ldflda ""System.Threading.Tasks.Sources.ManualResetValueTaskSourceCore<bool> C.<M>d__0.<>v__promiseOfValueOrEnd""
IL_010b: ldc.i4.0
IL_010c: call ""void System.Threading.Tasks.Sources.ManualResetValueTaskSourceCore<bool>.SetResult(bool)""
IL_0111: nop
IL_0112: ret
IL_0113: ldarg.0
IL_0114: ldflda ""System.Threading.Tasks.Sources.ManualResetValueTaskSourceCore<bool> C.<M>d__0.<>v__promiseOfValueOrEnd""
IL_0119: ldc.i4.1
IL_011a: call ""void System.Threading.Tasks.Sources.ManualResetValueTaskSourceCore<bool>.SetResult(bool)""
IL_011f: nop
IL_0120: ret
}
", sequencePoints: "C+<M>d__0.MoveNext", source: source);
IL_010e: ldarg.0
IL_010f: ldflda ""System.Threading.Tasks.Sources.ManualResetValueTaskSourceCore<bool> C.<M>d__0.<>v__promiseOfValueOrEnd""
IL_0114: ldc.i4.0
IL_0115: call ""void System.Threading.Tasks.Sources.ManualResetValueTaskSourceCore<bool>.SetResult(bool)""
IL_011a: nop
IL_011b: ret
IL_011c: ldarg.0
IL_011d: ldflda ""System.Threading.Tasks.Sources.ManualResetValueTaskSourceCore<bool> C.<M>d__0.<>v__promiseOfValueOrEnd""
IL_0122: ldc.i4.1
IL_0123: call ""void System.Threading.Tasks.Sources.ManualResetValueTaskSourceCore<bool>.SetResult(bool)""
IL_0128: nop
IL_0129: ret
}", sequencePoints: "C+<M>d__0.MoveNext", source: source);
}
else
{
......
......@@ -1479,5 +1479,439 @@ static class Program {
// static Task Main() {
Diagnostic(ErrorCode.ERR_DeprecatedSymbolStr, "Task").WithArguments("MyExtensions.GetAwaiter(System.Threading.Tasks.Task)", "test").WithLocation(31, 12));
}
[Fact]
[WorkItem(33542, "https://github.com/dotnet/roslyn/issues/33542")]
public void AwaitInFinallyInNestedTry_01()
{
string source =
@"using System.Threading.Tasks;
class Program
{
static async Task Main()
{
try
{
try
{
return;
}
finally
{
await Task.CompletedTask;
}
}
catch
{
}
finally
{
await Task.CompletedTask;
}
}
}";
var comp = CreateCompilation(source, options: TestOptions.ReleaseExe.WithOptimizationLevel(OptimizationLevel.Release));
var verifier = CompileAndVerify(comp, expectedOutput: "");
verifier.VerifyIL("Program.<Main>d__0.System.Runtime.CompilerServices.IAsyncStateMachine.MoveNext()",
@"{
// Code size 426 (0x1aa)
.maxstack 3
.locals init (int V_0,
object V_1,
System.Runtime.CompilerServices.TaskAwaiter V_2,
int V_3,
System.Exception V_4)
IL_0000: ldarg.0
IL_0001: ldfld ""int Program.<Main>d__0.<>1__state""
IL_0006: stloc.0
.try
{
IL_0007: ldloc.0
IL_0008: brfalse.s IL_001f
IL_000a: ldloc.0
IL_000b: ldc.i4.1
IL_000c: beq IL_0125
IL_0011: ldarg.0
IL_0012: ldnull
IL_0013: stfld ""object Program.<Main>d__0.<>7__wrap1""
IL_0018: ldarg.0
IL_0019: ldc.i4.0
IL_001a: stfld ""int Program.<Main>d__0.<>7__wrap2""
IL_001f: nop
.try
{
IL_0020: ldloc.0
IL_0021: pop
IL_0022: nop
.try
{
IL_0023: ldloc.0
IL_0024: brfalse.s IL_007e
IL_0026: ldarg.0
IL_0027: ldnull
IL_0028: stfld ""object Program.<Main>d__0.<>7__wrap3""
IL_002d: ldarg.0
IL_002e: ldc.i4.0
IL_002f: stfld ""int Program.<Main>d__0.<>7__wrap4""
.try
{
IL_0034: ldarg.0
IL_0035: ldc.i4.1
IL_0036: stfld ""int Program.<Main>d__0.<>7__wrap4""
IL_003b: leave.s IL_0047
}
catch object
{
IL_003d: stloc.1
IL_003e: ldarg.0
IL_003f: ldloc.1
IL_0040: stfld ""object Program.<Main>d__0.<>7__wrap3""
IL_0045: leave.s IL_0047
}
IL_0047: call ""System.Threading.Tasks.Task System.Threading.Tasks.Task.CompletedTask.get""
IL_004c: callvirt ""System.Runtime.CompilerServices.TaskAwaiter System.Threading.Tasks.Task.GetAwaiter()""
IL_0051: stloc.2
IL_0052: ldloca.s V_2
IL_0054: call ""bool System.Runtime.CompilerServices.TaskAwaiter.IsCompleted.get""
IL_0059: brtrue.s IL_009a
IL_005b: ldarg.0
IL_005c: ldc.i4.0
IL_005d: dup
IL_005e: stloc.0
IL_005f: stfld ""int Program.<Main>d__0.<>1__state""
IL_0064: ldarg.0
IL_0065: ldloc.2
IL_0066: stfld ""System.Runtime.CompilerServices.TaskAwaiter Program.<Main>d__0.<>u__1""
IL_006b: ldarg.0
IL_006c: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder Program.<Main>d__0.<>t__builder""
IL_0071: ldloca.s V_2
IL_0073: ldarg.0
IL_0074: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder.AwaitUnsafeOnCompleted<System.Runtime.CompilerServices.TaskAwaiter, Program.<Main>d__0>(ref System.Runtime.CompilerServices.TaskAwaiter, ref Program.<Main>d__0)""
IL_0079: leave IL_01a9
IL_007e: ldarg.0
IL_007f: ldfld ""System.Runtime.CompilerServices.TaskAwaiter Program.<Main>d__0.<>u__1""
IL_0084: stloc.2
IL_0085: ldarg.0
IL_0086: ldflda ""System.Runtime.CompilerServices.TaskAwaiter Program.<Main>d__0.<>u__1""
IL_008b: initobj ""System.Runtime.CompilerServices.TaskAwaiter""
IL_0091: ldarg.0
IL_0092: ldc.i4.m1
IL_0093: dup
IL_0094: stloc.0
IL_0095: stfld ""int Program.<Main>d__0.<>1__state""
IL_009a: ldloca.s V_2
IL_009c: call ""void System.Runtime.CompilerServices.TaskAwaiter.GetResult()""
IL_00a1: ldarg.0
IL_00a2: ldfld ""object Program.<Main>d__0.<>7__wrap3""
IL_00a7: stloc.1
IL_00a8: ldloc.1
IL_00a9: brfalse.s IL_00c0
IL_00ab: ldloc.1
IL_00ac: isinst ""System.Exception""
IL_00b1: dup
IL_00b2: brtrue.s IL_00b6
IL_00b4: ldloc.1
IL_00b5: throw
IL_00b6: call ""System.Runtime.ExceptionServices.ExceptionDispatchInfo System.Runtime.ExceptionServices.ExceptionDispatchInfo.Capture(System.Exception)""
IL_00bb: callvirt ""void System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()""
IL_00c0: ldarg.0
IL_00c1: ldfld ""int Program.<Main>d__0.<>7__wrap4""
IL_00c6: stloc.3
IL_00c7: ldloc.3
IL_00c8: ldc.i4.1
IL_00c9: bne.un.s IL_00cd
IL_00cb: leave.s IL_00db
IL_00cd: ldarg.0
IL_00ce: ldnull
IL_00cf: stfld ""object Program.<Main>d__0.<>7__wrap3""
IL_00d4: leave.s IL_00d9
}
catch object
{
IL_00d6: pop
IL_00d7: leave.s IL_00d9
}
IL_00d9: leave.s IL_00ee
IL_00db: ldarg.0
IL_00dc: ldc.i4.1
IL_00dd: stfld ""int Program.<Main>d__0.<>7__wrap2""
IL_00e2: leave.s IL_00ee
}
catch object
{
IL_00e4: stloc.1
IL_00e5: ldarg.0
IL_00e6: ldloc.1
IL_00e7: stfld ""object Program.<Main>d__0.<>7__wrap1""
IL_00ec: leave.s IL_00ee
}
IL_00ee: call ""System.Threading.Tasks.Task System.Threading.Tasks.Task.CompletedTask.get""
IL_00f3: callvirt ""System.Runtime.CompilerServices.TaskAwaiter System.Threading.Tasks.Task.GetAwaiter()""
IL_00f8: stloc.2
IL_00f9: ldloca.s V_2
IL_00fb: call ""bool System.Runtime.CompilerServices.TaskAwaiter.IsCompleted.get""
IL_0100: brtrue.s IL_0141
IL_0102: ldarg.0
IL_0103: ldc.i4.1
IL_0104: dup
IL_0105: stloc.0
IL_0106: stfld ""int Program.<Main>d__0.<>1__state""
IL_010b: ldarg.0
IL_010c: ldloc.2
IL_010d: stfld ""System.Runtime.CompilerServices.TaskAwaiter Program.<Main>d__0.<>u__1""
IL_0112: ldarg.0
IL_0113: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder Program.<Main>d__0.<>t__builder""
IL_0118: ldloca.s V_2
IL_011a: ldarg.0
IL_011b: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder.AwaitUnsafeOnCompleted<System.Runtime.CompilerServices.TaskAwaiter, Program.<Main>d__0>(ref System.Runtime.CompilerServices.TaskAwaiter, ref Program.<Main>d__0)""
IL_0120: leave IL_01a9
IL_0125: ldarg.0
IL_0126: ldfld ""System.Runtime.CompilerServices.TaskAwaiter Program.<Main>d__0.<>u__1""
IL_012b: stloc.2
IL_012c: ldarg.0
IL_012d: ldflda ""System.Runtime.CompilerServices.TaskAwaiter Program.<Main>d__0.<>u__1""
IL_0132: initobj ""System.Runtime.CompilerServices.TaskAwaiter""
IL_0138: ldarg.0
IL_0139: ldc.i4.m1
IL_013a: dup
IL_013b: stloc.0
IL_013c: stfld ""int Program.<Main>d__0.<>1__state""
IL_0141: ldloca.s V_2
IL_0143: call ""void System.Runtime.CompilerServices.TaskAwaiter.GetResult()""
IL_0148: ldarg.0
IL_0149: ldfld ""object Program.<Main>d__0.<>7__wrap1""
IL_014e: stloc.1
IL_014f: ldloc.1
IL_0150: brfalse.s IL_0167
IL_0152: ldloc.1
IL_0153: isinst ""System.Exception""
IL_0158: dup
IL_0159: brtrue.s IL_015d
IL_015b: ldloc.1
IL_015c: throw
IL_015d: call ""System.Runtime.ExceptionServices.ExceptionDispatchInfo System.Runtime.ExceptionServices.ExceptionDispatchInfo.Capture(System.Exception)""
IL_0162: callvirt ""void System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()""
IL_0167: ldarg.0
IL_0168: ldfld ""int Program.<Main>d__0.<>7__wrap2""
IL_016d: stloc.3
IL_016e: ldloc.3
IL_016f: ldc.i4.1
IL_0170: bne.un.s IL_0174
IL_0172: leave.s IL_0196
IL_0174: ldarg.0
IL_0175: ldnull
IL_0176: stfld ""object Program.<Main>d__0.<>7__wrap1""
IL_017b: leave.s IL_0196
}
catch System.Exception
{
IL_017d: stloc.s V_4
IL_017f: ldarg.0
IL_0180: ldc.i4.s -2
IL_0182: stfld ""int Program.<Main>d__0.<>1__state""
IL_0187: ldarg.0
IL_0188: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder Program.<Main>d__0.<>t__builder""
IL_018d: ldloc.s V_4
IL_018f: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder.SetException(System.Exception)""
IL_0194: leave.s IL_01a9
}
IL_0196: ldarg.0
IL_0197: ldc.i4.s -2
IL_0199: stfld ""int Program.<Main>d__0.<>1__state""
IL_019e: ldarg.0
IL_019f: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder Program.<Main>d__0.<>t__builder""
IL_01a4: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder.SetResult()""
IL_01a9: ret
}");
}
[Fact]
[WorkItem(34720, "https://github.com/dotnet/roslyn/issues/34720")]
public void AwaitInFinallyInNestedTry_02()
{
string source =
@"using System.IO;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
for (int i = 0; i < 5; i++)
{
using (new MemoryStream())
{
try
{
continue;
}
finally
{
await Task.Delay(1);
}
}
}
}
}";
var comp = CreateCompilation(source, options: TestOptions.ReleaseExe.WithOptimizationLevel(OptimizationLevel.Release));
var verifier = CompileAndVerify(comp, expectedOutput: "");
verifier.VerifyIL("Program.<Main>d__0.System.Runtime.CompilerServices.IAsyncStateMachine.MoveNext()",
@"{
// Code size 320 (0x140)
.maxstack 3
.locals init (int V_0,
object V_1,
System.Runtime.CompilerServices.TaskAwaiter V_2,
int V_3,
System.Exception V_4)
IL_0000: ldarg.0
IL_0001: ldfld ""int Program.<Main>d__0.<>1__state""
IL_0006: stloc.0
.try
{
IL_0007: ldloc.0
IL_0008: brfalse.s IL_0021
IL_000a: ldarg.0
IL_000b: ldc.i4.0
IL_000c: stfld ""int Program.<Main>d__0.<i>5__2""
IL_0011: br IL_0105
IL_0016: ldarg.0
IL_0017: newobj ""System.IO.MemoryStream..ctor()""
IL_001c: stfld ""System.IO.MemoryStream Program.<Main>d__0.<>7__wrap2""
IL_0021: nop
.try
{
IL_0022: ldloc.0
IL_0023: brfalse.s IL_007e
IL_0025: ldarg.0
IL_0026: ldnull
IL_0027: stfld ""object Program.<Main>d__0.<>7__wrap3""
IL_002c: ldarg.0
IL_002d: ldc.i4.0
IL_002e: stfld ""int Program.<Main>d__0.<>7__wrap4""
.try
{
IL_0033: ldarg.0
IL_0034: ldc.i4.1
IL_0035: stfld ""int Program.<Main>d__0.<>7__wrap4""
IL_003a: leave.s IL_0046
}
catch object
{
IL_003c: stloc.1
IL_003d: ldarg.0
IL_003e: ldloc.1
IL_003f: stfld ""object Program.<Main>d__0.<>7__wrap3""
IL_0044: leave.s IL_0046
}
IL_0046: ldc.i4.1
IL_0047: call ""System.Threading.Tasks.Task System.Threading.Tasks.Task.Delay(int)""
IL_004c: callvirt ""System.Runtime.CompilerServices.TaskAwaiter System.Threading.Tasks.Task.GetAwaiter()""
IL_0051: stloc.2
IL_0052: ldloca.s V_2
IL_0054: call ""bool System.Runtime.CompilerServices.TaskAwaiter.IsCompleted.get""
IL_0059: brtrue.s IL_009a
IL_005b: ldarg.0
IL_005c: ldc.i4.0
IL_005d: dup
IL_005e: stloc.0
IL_005f: stfld ""int Program.<Main>d__0.<>1__state""
IL_0064: ldarg.0
IL_0065: ldloc.2
IL_0066: stfld ""System.Runtime.CompilerServices.TaskAwaiter Program.<Main>d__0.<>u__1""
IL_006b: ldarg.0
IL_006c: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder Program.<Main>d__0.<>t__builder""
IL_0071: ldloca.s V_2
IL_0073: ldarg.0
IL_0074: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder.AwaitUnsafeOnCompleted<System.Runtime.CompilerServices.TaskAwaiter, Program.<Main>d__0>(ref System.Runtime.CompilerServices.TaskAwaiter, ref Program.<Main>d__0)""
IL_0079: leave IL_013f
IL_007e: ldarg.0
IL_007f: ldfld ""System.Runtime.CompilerServices.TaskAwaiter Program.<Main>d__0.<>u__1""
IL_0084: stloc.2
IL_0085: ldarg.0
IL_0086: ldflda ""System.Runtime.CompilerServices.TaskAwaiter Program.<Main>d__0.<>u__1""
IL_008b: initobj ""System.Runtime.CompilerServices.TaskAwaiter""
IL_0091: ldarg.0
IL_0092: ldc.i4.m1
IL_0093: dup
IL_0094: stloc.0
IL_0095: stfld ""int Program.<Main>d__0.<>1__state""
IL_009a: ldloca.s V_2
IL_009c: call ""void System.Runtime.CompilerServices.TaskAwaiter.GetResult()""
IL_00a1: ldarg.0
IL_00a2: ldfld ""object Program.<Main>d__0.<>7__wrap3""
IL_00a7: stloc.1
IL_00a8: ldloc.1
IL_00a9: brfalse.s IL_00c0
IL_00ab: ldloc.1
IL_00ac: isinst ""System.Exception""
IL_00b1: dup
IL_00b2: brtrue.s IL_00b6
IL_00b4: ldloc.1
IL_00b5: throw
IL_00b6: call ""System.Runtime.ExceptionServices.ExceptionDispatchInfo System.Runtime.ExceptionServices.ExceptionDispatchInfo.Capture(System.Exception)""
IL_00bb: callvirt ""void System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()""
IL_00c0: ldarg.0
IL_00c1: ldfld ""int Program.<Main>d__0.<>7__wrap4""
IL_00c6: stloc.3
IL_00c7: ldloc.3
IL_00c8: ldc.i4.1
IL_00c9: bne.un.s IL_00cd
IL_00cb: leave.s IL_00f5
IL_00cd: ldarg.0
IL_00ce: ldnull
IL_00cf: stfld ""object Program.<Main>d__0.<>7__wrap3""
IL_00d4: leave.s IL_00ee
}
finally
{
IL_00d6: ldloc.0
IL_00d7: ldc.i4.0
IL_00d8: bge.s IL_00ed
IL_00da: ldarg.0
IL_00db: ldfld ""System.IO.MemoryStream Program.<Main>d__0.<>7__wrap2""
IL_00e0: brfalse.s IL_00ed
IL_00e2: ldarg.0
IL_00e3: ldfld ""System.IO.MemoryStream Program.<Main>d__0.<>7__wrap2""
IL_00e8: callvirt ""void System.IDisposable.Dispose()""
IL_00ed: endfinally
}
IL_00ee: ldarg.0
IL_00ef: ldnull
IL_00f0: stfld ""System.IO.MemoryStream Program.<Main>d__0.<>7__wrap2""
IL_00f5: ldarg.0
IL_00f6: ldfld ""int Program.<Main>d__0.<i>5__2""
IL_00fb: stloc.3
IL_00fc: ldarg.0
IL_00fd: ldloc.3
IL_00fe: ldc.i4.1
IL_00ff: add
IL_0100: stfld ""int Program.<Main>d__0.<i>5__2""
IL_0105: ldarg.0
IL_0106: ldfld ""int Program.<Main>d__0.<i>5__2""
IL_010b: ldc.i4.5
IL_010c: blt IL_0016
IL_0111: leave.s IL_012c
}
catch System.Exception
{
IL_0113: stloc.s V_4
IL_0115: ldarg.0
IL_0116: ldc.i4.s -2
IL_0118: stfld ""int Program.<Main>d__0.<>1__state""
IL_011d: ldarg.0
IL_011e: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder Program.<Main>d__0.<>t__builder""
IL_0123: ldloc.s V_4
IL_0125: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder.SetException(System.Exception)""
IL_012a: leave.s IL_013f
}
IL_012c: ldarg.0
IL_012d: ldc.i4.s -2
IL_012f: stfld ""int Program.<Main>d__0.<>1__state""
IL_0134: ldarg.0
IL_0135: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder Program.<Main>d__0.<>t__builder""
IL_013a: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder.SetResult()""
IL_013f: ret
}");
}
}
}
......@@ -594,9 +594,9 @@ public static async Task<int> F(int[] array)
";
var v = CompileAndVerify(source, options: TestOptions.DebugDll);
v.VerifyIL("Test.<F>d__2.System.Runtime.CompilerServices.IAsyncStateMachine.MoveNext", @"
{
// Code size 271 (0x10f)
v.VerifyIL("Test.<F>d__2.System.Runtime.CompilerServices.IAsyncStateMachine.MoveNext",
@"{
// Code size 273 (0x111)
.maxstack 5
.locals init (int V_0,
int V_1,
......@@ -610,122 +610,123 @@ .maxstack 5
.try
{
~IL_0007: ldloc.0
IL_0008: brfalse.s IL_0086
IL_000a: br.s IL_000c
-IL_000c: nop
-IL_000d: ldarg.0
IL_000e: ldarg.0
IL_000f: ldfld ""int[] Test.<F>d__2.array""
IL_0014: ldc.i4.1
IL_0015: ldelema ""int""
IL_001a: dup
IL_001b: ldind.i4
IL_001c: ldc.i4.2
IL_001d: add
IL_001e: dup
IL_001f: stloc.2
IL_0020: stind.i4
IL_0021: ldloc.2
IL_0022: stfld ""int Test.<F>d__2.<>s__1""
IL_0027: ldarg.0
IL_0028: ldarg.0
IL_0029: ldfld ""int[] Test.<F>d__2.array""
IL_002e: stfld ""int[] Test.<F>d__2.<>s__4""
IL_0033: ldarg.0
IL_0034: ldfld ""int[] Test.<F>d__2.<>s__4""
IL_0039: ldc.i4.3
IL_003a: ldelem.i4
IL_003b: pop
IL_003c: ldarg.0
IL_003d: ldarg.0
IL_003e: ldfld ""int[] Test.<F>d__2.<>s__4""
IL_0043: ldc.i4.3
IL_0044: ldelem.i4
IL_0045: stfld ""int Test.<F>d__2.<>s__2""
IL_004a: call ""System.Threading.Tasks.Task<int> Test.G()""
IL_004f: callvirt ""System.Runtime.CompilerServices.TaskAwaiter<int> System.Threading.Tasks.Task<int>.GetAwaiter()""
IL_0054: stloc.3
~IL_0055: ldloca.s V_3
IL_0057: call ""bool System.Runtime.CompilerServices.TaskAwaiter<int>.IsCompleted.get""
IL_005c: brtrue.s IL_00a2
IL_005e: ldarg.0
IL_005f: ldc.i4.0
IL_0060: dup
IL_0061: stloc.0
IL_0062: stfld ""int Test.<F>d__2.<>1__state""
<IL_0067: ldarg.0
IL_0068: ldloc.3
IL_0069: stfld ""System.Runtime.CompilerServices.TaskAwaiter<int> Test.<F>d__2.<>u__1""
IL_006e: ldarg.0
IL_006f: stloc.s V_4
IL_0071: ldarg.0
IL_0072: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<F>d__2.<>t__builder""
IL_0077: ldloca.s V_3
IL_0079: ldloca.s V_4
IL_007b: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.AwaitUnsafeOnCompleted<System.Runtime.CompilerServices.TaskAwaiter<int>, Test.<F>d__2>(ref System.Runtime.CompilerServices.TaskAwaiter<int>, ref Test.<F>d__2)""
IL_0080: nop
IL_0081: leave IL_010e
>IL_0086: ldarg.0
IL_0087: ldfld ""System.Runtime.CompilerServices.TaskAwaiter<int> Test.<F>d__2.<>u__1""
IL_008c: stloc.3
IL_008d: ldarg.0
IL_008e: ldflda ""System.Runtime.CompilerServices.TaskAwaiter<int> Test.<F>d__2.<>u__1""
IL_0093: initobj ""System.Runtime.CompilerServices.TaskAwaiter<int>""
IL_0099: ldarg.0
IL_009a: ldc.i4.m1
IL_009b: dup
IL_009c: stloc.0
IL_009d: stfld ""int Test.<F>d__2.<>1__state""
IL_00a2: ldarg.0
IL_00a3: ldloca.s V_3
IL_00a5: call ""int System.Runtime.CompilerServices.TaskAwaiter<int>.GetResult()""
IL_00aa: stfld ""int Test.<F>d__2.<>s__3""
IL_00af: ldarg.0
IL_00b0: ldfld ""int Test.<F>d__2.<>s__1""
IL_00b5: ldarg.0
IL_00b6: ldfld ""int[] Test.<F>d__2.<>s__4""
IL_00bb: ldc.i4.3
IL_00bc: ldarg.0
IL_00bd: ldfld ""int Test.<F>d__2.<>s__2""
IL_00c2: ldarg.0
IL_00c3: ldfld ""int Test.<F>d__2.<>s__3""
IL_00c8: add
IL_00c9: dup
IL_00ca: stloc.2
IL_00cb: stelem.i4
IL_00cc: ldloc.2
IL_00cd: ldc.i4.4
IL_00ce: call ""int Test.H(int, int, int)""
IL_00d3: pop
IL_00d4: ldarg.0
IL_00d5: ldnull
IL_00d6: stfld ""int[] Test.<F>d__2.<>s__4""
-IL_00db: ldc.i4.1
IL_00dc: stloc.1
IL_00dd: leave.s IL_00f9
IL_0008: brfalse.s IL_000c
IL_000a: br.s IL_000e
IL_000c: br.s IL_0088
-IL_000e: nop
-IL_000f: ldarg.0
IL_0010: ldarg.0
IL_0011: ldfld ""int[] Test.<F>d__2.array""
IL_0016: ldc.i4.1
IL_0017: ldelema ""int""
IL_001c: dup
IL_001d: ldind.i4
IL_001e: ldc.i4.2
IL_001f: add
IL_0020: dup
IL_0021: stloc.2
IL_0022: stind.i4
IL_0023: ldloc.2
IL_0024: stfld ""int Test.<F>d__2.<>s__1""
IL_0029: ldarg.0
IL_002a: ldarg.0
IL_002b: ldfld ""int[] Test.<F>d__2.array""
IL_0030: stfld ""int[] Test.<F>d__2.<>s__4""
IL_0035: ldarg.0
IL_0036: ldfld ""int[] Test.<F>d__2.<>s__4""
IL_003b: ldc.i4.3
IL_003c: ldelem.i4
IL_003d: pop
IL_003e: ldarg.0
IL_003f: ldarg.0
IL_0040: ldfld ""int[] Test.<F>d__2.<>s__4""
IL_0045: ldc.i4.3
IL_0046: ldelem.i4
IL_0047: stfld ""int Test.<F>d__2.<>s__2""
IL_004c: call ""System.Threading.Tasks.Task<int> Test.G()""
IL_0051: callvirt ""System.Runtime.CompilerServices.TaskAwaiter<int> System.Threading.Tasks.Task<int>.GetAwaiter()""
IL_0056: stloc.3
~IL_0057: ldloca.s V_3
IL_0059: call ""bool System.Runtime.CompilerServices.TaskAwaiter<int>.IsCompleted.get""
IL_005e: brtrue.s IL_00a4
IL_0060: ldarg.0
IL_0061: ldc.i4.0
IL_0062: dup
IL_0063: stloc.0
IL_0064: stfld ""int Test.<F>d__2.<>1__state""
<IL_0069: ldarg.0
IL_006a: ldloc.3
IL_006b: stfld ""System.Runtime.CompilerServices.TaskAwaiter<int> Test.<F>d__2.<>u__1""
IL_0070: ldarg.0
IL_0071: stloc.s V_4
IL_0073: ldarg.0
IL_0074: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<F>d__2.<>t__builder""
IL_0079: ldloca.s V_3
IL_007b: ldloca.s V_4
IL_007d: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.AwaitUnsafeOnCompleted<System.Runtime.CompilerServices.TaskAwaiter<int>, Test.<F>d__2>(ref System.Runtime.CompilerServices.TaskAwaiter<int>, ref Test.<F>d__2)""
IL_0082: nop
IL_0083: leave IL_0110
>IL_0088: ldarg.0
IL_0089: ldfld ""System.Runtime.CompilerServices.TaskAwaiter<int> Test.<F>d__2.<>u__1""
IL_008e: stloc.3
IL_008f: ldarg.0
IL_0090: ldflda ""System.Runtime.CompilerServices.TaskAwaiter<int> Test.<F>d__2.<>u__1""
IL_0095: initobj ""System.Runtime.CompilerServices.TaskAwaiter<int>""
IL_009b: ldarg.0
IL_009c: ldc.i4.m1
IL_009d: dup
IL_009e: stloc.0
IL_009f: stfld ""int Test.<F>d__2.<>1__state""
IL_00a4: ldarg.0
IL_00a5: ldloca.s V_3
IL_00a7: call ""int System.Runtime.CompilerServices.TaskAwaiter<int>.GetResult()""
IL_00ac: stfld ""int Test.<F>d__2.<>s__3""
IL_00b1: ldarg.0
IL_00b2: ldfld ""int Test.<F>d__2.<>s__1""
IL_00b7: ldarg.0
IL_00b8: ldfld ""int[] Test.<F>d__2.<>s__4""
IL_00bd: ldc.i4.3
IL_00be: ldarg.0
IL_00bf: ldfld ""int Test.<F>d__2.<>s__2""
IL_00c4: ldarg.0
IL_00c5: ldfld ""int Test.<F>d__2.<>s__3""
IL_00ca: add
IL_00cb: dup
IL_00cc: stloc.2
IL_00cd: stelem.i4
IL_00ce: ldloc.2
IL_00cf: ldc.i4.4
IL_00d0: call ""int Test.H(int, int, int)""
IL_00d5: pop
IL_00d6: ldarg.0
IL_00d7: ldnull
IL_00d8: stfld ""int[] Test.<F>d__2.<>s__4""
-IL_00dd: ldc.i4.1
IL_00de: stloc.1
IL_00df: leave.s IL_00fb
}
catch System.Exception
{
~IL_00df: stloc.s V_5
IL_00e1: ldarg.0
IL_00e2: ldc.i4.s -2
IL_00e4: stfld ""int Test.<F>d__2.<>1__state""
IL_00e9: ldarg.0
IL_00ea: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<F>d__2.<>t__builder""
IL_00ef: ldloc.s V_5
IL_00f1: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.SetException(System.Exception)""
IL_00f6: nop
IL_00f7: leave.s IL_010e
~IL_00e1: stloc.s V_5
IL_00e3: ldarg.0
IL_00e4: ldc.i4.s -2
IL_00e6: stfld ""int Test.<F>d__2.<>1__state""
IL_00eb: ldarg.0
IL_00ec: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<F>d__2.<>t__builder""
IL_00f1: ldloc.s V_5
IL_00f3: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.SetException(System.Exception)""
IL_00f8: nop
IL_00f9: leave.s IL_0110
}
-IL_00f9: ldarg.0
IL_00fa: ldc.i4.s -2
IL_00fc: stfld ""int Test.<F>d__2.<>1__state""
~IL_0101: ldarg.0
IL_0102: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<F>d__2.<>t__builder""
IL_0107: ldloc.1
IL_0108: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.SetResult(int)""
IL_010d: nop
IL_010e: ret
-IL_00fb: ldarg.0
IL_00fc: ldc.i4.s -2
IL_00fe: stfld ""int Test.<F>d__2.<>1__state""
~IL_0103: ldarg.0
IL_0104: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<F>d__2.<>t__builder""
IL_0109: ldloc.1
IL_010a: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.SetResult(int)""
IL_010f: nop
IL_0110: ret
}", sequencePoints: "Test+<F>d__2.MoveNext");
}
......
......@@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using Microsoft.CodeAnalysis.CSharp.Symbols;
using Microsoft.CodeAnalysis.CSharp.Test.Utilities;
using Microsoft.CodeAnalysis.Test.Utilities;
......@@ -598,7 +597,6 @@ static async void Qux<T>(Func<Task<T>> x)
if ((int)(object)y == 1)
count++;
}
}
class Driver
......@@ -783,7 +781,6 @@ public async void Run()
Driver.CompleteSignal.Set();
}
}
}
class Driver
......@@ -2259,7 +2256,6 @@ .maxstack 2
");
}
[Fact]
public void AsyncStateMachineIL_Class_TaskT()
{
......@@ -2315,7 +2311,7 @@ .maxstack 2
c.VerifyIL("Test.<F>d__0.System.Runtime.CompilerServices.IAsyncStateMachine.MoveNext", @"
{
// Code size 203 (0xcb)
// Code size 205 (0xcd)
.maxstack 3
.locals init (int V_0,
int V_1,
......@@ -2328,84 +2324,85 @@ .maxstack 3
.try
{
~IL_0007: ldloc.0
IL_0008: brfalse.s IL_0069
IL_000a: br.s IL_000c
-IL_000c: nop
-IL_000d: call ""System.Threading.Tasks.TaskFactory System.Threading.Tasks.Task.Factory.get""
IL_0012: ldsfld ""System.Func<int> Test.<>c.<>9__0_0""
IL_0017: dup
IL_0018: brtrue.s IL_0031
IL_001a: pop
IL_001b: ldsfld ""Test.<>c Test.<>c.<>9""
IL_0020: ldftn ""int Test.<>c.<F>b__0_0()""
IL_0026: newobj ""System.Func<int>..ctor(object, System.IntPtr)""
IL_002b: dup
IL_002c: stsfld ""System.Func<int> Test.<>c.<>9__0_0""
IL_0031: callvirt ""System.Threading.Tasks.Task<int> System.Threading.Tasks.TaskFactory.StartNew<int>(System.Func<int>)""
IL_0036: callvirt ""System.Runtime.CompilerServices.TaskAwaiter<int> System.Threading.Tasks.Task<int>.GetAwaiter()""
IL_003b: stloc.2
~IL_003c: ldloca.s V_2
IL_003e: call ""bool System.Runtime.CompilerServices.TaskAwaiter<int>.IsCompleted.get""
IL_0043: brtrue.s IL_0085
IL_0045: ldarg.0
IL_0046: ldc.i4.0
IL_0047: dup
IL_0048: stloc.0
IL_0049: stfld ""int Test.<F>d__0.<>1__state""
<IL_004e: ldarg.0
IL_004f: ldloc.2
IL_0050: stfld ""System.Runtime.CompilerServices.TaskAwaiter<int> Test.<F>d__0.<>u__1""
IL_0055: ldarg.0
IL_0056: stloc.3
IL_0008: brfalse.s IL_000c
IL_000a: br.s IL_000e
IL_000c: br.s IL_006b
-IL_000e: nop
-IL_000f: call ""System.Threading.Tasks.TaskFactory System.Threading.Tasks.Task.Factory.get""
IL_0014: ldsfld ""System.Func<int> Test.<>c.<>9__0_0""
IL_0019: dup
IL_001a: brtrue.s IL_0033
IL_001c: pop
IL_001d: ldsfld ""Test.<>c Test.<>c.<>9""
IL_0022: ldftn ""int Test.<>c.<F>b__0_0()""
IL_0028: newobj ""System.Func<int>..ctor(object, System.IntPtr)""
IL_002d: dup
IL_002e: stsfld ""System.Func<int> Test.<>c.<>9__0_0""
IL_0033: callvirt ""System.Threading.Tasks.Task<int> System.Threading.Tasks.TaskFactory.StartNew<int>(System.Func<int>)""
IL_0038: callvirt ""System.Runtime.CompilerServices.TaskAwaiter<int> System.Threading.Tasks.Task<int>.GetAwaiter()""
IL_003d: stloc.2
~IL_003e: ldloca.s V_2
IL_0040: call ""bool System.Runtime.CompilerServices.TaskAwaiter<int>.IsCompleted.get""
IL_0045: brtrue.s IL_0087
IL_0047: ldarg.0
IL_0048: ldc.i4.0
IL_0049: dup
IL_004a: stloc.0
IL_004b: stfld ""int Test.<F>d__0.<>1__state""
<IL_0050: ldarg.0
IL_0051: ldloc.2
IL_0052: stfld ""System.Runtime.CompilerServices.TaskAwaiter<int> Test.<F>d__0.<>u__1""
IL_0057: ldarg.0
IL_0058: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<F>d__0.<>t__builder""
IL_005d: ldloca.s V_2
IL_005f: ldloca.s V_3
IL_0061: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.AwaitUnsafeOnCompleted<System.Runtime.CompilerServices.TaskAwaiter<int>, Test.<F>d__0>(ref System.Runtime.CompilerServices.TaskAwaiter<int>, ref Test.<F>d__0)""
IL_0066: nop
IL_0067: leave.s IL_00ca
>IL_0069: ldarg.0
IL_006a: ldfld ""System.Runtime.CompilerServices.TaskAwaiter<int> Test.<F>d__0.<>u__1""
IL_006f: stloc.2
IL_0070: ldarg.0
IL_0071: ldflda ""System.Runtime.CompilerServices.TaskAwaiter<int> Test.<F>d__0.<>u__1""
IL_0076: initobj ""System.Runtime.CompilerServices.TaskAwaiter<int>""
IL_007c: ldarg.0
IL_007d: ldc.i4.m1
IL_007e: dup
IL_007f: stloc.0
IL_0080: stfld ""int Test.<F>d__0.<>1__state""
IL_0085: ldarg.0
IL_0086: ldloca.s V_2
IL_0088: call ""int System.Runtime.CompilerServices.TaskAwaiter<int>.GetResult()""
IL_008d: stfld ""int Test.<F>d__0.<>s__1""
IL_0092: ldarg.0
IL_0093: ldfld ""int Test.<F>d__0.<>s__1""
IL_0098: stloc.1
IL_0099: leave.s IL_00b5
IL_0058: stloc.3
IL_0059: ldarg.0
IL_005a: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<F>d__0.<>t__builder""
IL_005f: ldloca.s V_2
IL_0061: ldloca.s V_3
IL_0063: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.AwaitUnsafeOnCompleted<System.Runtime.CompilerServices.TaskAwaiter<int>, Test.<F>d__0>(ref System.Runtime.CompilerServices.TaskAwaiter<int>, ref Test.<F>d__0)""
IL_0068: nop
IL_0069: leave.s IL_00cc
>IL_006b: ldarg.0
IL_006c: ldfld ""System.Runtime.CompilerServices.TaskAwaiter<int> Test.<F>d__0.<>u__1""
IL_0071: stloc.2
IL_0072: ldarg.0
IL_0073: ldflda ""System.Runtime.CompilerServices.TaskAwaiter<int> Test.<F>d__0.<>u__1""
IL_0078: initobj ""System.Runtime.CompilerServices.TaskAwaiter<int>""
IL_007e: ldarg.0
IL_007f: ldc.i4.m1
IL_0080: dup
IL_0081: stloc.0
IL_0082: stfld ""int Test.<F>d__0.<>1__state""
IL_0087: ldarg.0
IL_0088: ldloca.s V_2
IL_008a: call ""int System.Runtime.CompilerServices.TaskAwaiter<int>.GetResult()""
IL_008f: stfld ""int Test.<F>d__0.<>s__1""
IL_0094: ldarg.0
IL_0095: ldfld ""int Test.<F>d__0.<>s__1""
IL_009a: stloc.1
IL_009b: leave.s IL_00b7
}
catch System.Exception
{
~IL_009b: stloc.s V_4
IL_009d: ldarg.0
IL_009e: ldc.i4.s -2
IL_00a0: stfld ""int Test.<F>d__0.<>1__state""
IL_00a5: ldarg.0
IL_00a6: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<F>d__0.<>t__builder""
IL_00ab: ldloc.s V_4
IL_00ad: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.SetException(System.Exception)""
IL_00b2: nop
IL_00b3: leave.s IL_00ca
~IL_009d: stloc.s V_4
IL_009f: ldarg.0
IL_00a0: ldc.i4.s -2
IL_00a2: stfld ""int Test.<F>d__0.<>1__state""
IL_00a7: ldarg.0
IL_00a8: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<F>d__0.<>t__builder""
IL_00ad: ldloc.s V_4
IL_00af: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.SetException(System.Exception)""
IL_00b4: nop
IL_00b5: leave.s IL_00cc
}
-IL_00b5: ldarg.0
IL_00b6: ldc.i4.s -2
IL_00b8: stfld ""int Test.<F>d__0.<>1__state""
~IL_00bd: ldarg.0
IL_00be: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<F>d__0.<>t__builder""
IL_00c3: ldloc.1
IL_00c4: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.SetResult(int)""
IL_00c9: nop
IL_00ca: ret
-IL_00b7: ldarg.0
IL_00b8: ldc.i4.s -2
IL_00ba: stfld ""int Test.<F>d__0.<>1__state""
~IL_00bf: ldarg.0
IL_00c0: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<F>d__0.<>t__builder""
IL_00c5: ldloc.1
IL_00c6: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.SetResult(int)""
IL_00cb: nop
IL_00cc: ret
}", sequencePoints: "Test+<F>d__0.MoveNext");
c.VerifyIL("Test.<F>d__0.System.Runtime.CompilerServices.IAsyncStateMachine.SetStateMachine", @"
......@@ -3431,7 +3428,6 @@ namespace System.Runtime.CompilerServices { class AsyncMethodBuilderAttribute :
);
}
[Fact]
public void AsyncTasklikeBadAttributeArgument2()
{
......@@ -3546,7 +3542,6 @@ class Program {
);
}
[Fact]
public void AsyncTasklikeCreateMethod()
{
......@@ -3646,7 +3641,6 @@ namespace System.Runtime.CompilerServices {{ class AsyncMethodBuilderAttribute :
);
}
[Fact]
public void AsyncTasklikeBuilderAccessibility()
{
......@@ -3686,7 +3680,6 @@ namespace System.Runtime.CompilerServices {{ class AsyncMethodBuilderAttribute :
);
}
[Fact]
public void AsyncTasklikeLambdaOverloads()
{
......@@ -4048,7 +4041,7 @@ public static async Task<int> F()
v.VerifyIL("Test.<F>d__2.System.Runtime.CompilerServices.IAsyncStateMachine.MoveNext()", @"
{
// Code size 222 (0xde)
// Code size 224 (0xe0)
.maxstack 3
.locals init (int V_0,
int V_1,
......@@ -4061,92 +4054,93 @@ .maxstack 3
.try
{
~IL_0007: ldloc.0
IL_0008: brfalse.s IL_006b
IL_000a: br.s IL_000c
-IL_000c: nop
-IL_000d: ldarg.0
IL_000e: ldc.i4.s 10
IL_0010: newarr ""S""
IL_0015: stfld ""S[] Test.<F>d__2.<array>5__1""
-IL_001a: ldarg.0
IL_001b: ldarg.0
IL_001c: ldfld ""S[] Test.<F>d__2.<array>5__1""
IL_0021: stfld ""S[] Test.<F>d__2.<>s__3""
IL_0026: ldarg.0
IL_0027: ldfld ""S[] Test.<F>d__2.<>s__3""
IL_002c: ldc.i4.1
IL_002d: ldelema ""S""
IL_0032: pop
IL_0033: call ""System.Threading.Tasks.Task<int> Test.G()""
IL_0038: callvirt ""System.Runtime.CompilerServices.TaskAwaiter<int> System.Threading.Tasks.Task<int>.GetAwaiter()""
IL_003d: stloc.2
~IL_003e: ldloca.s V_2
IL_0040: call ""bool System.Runtime.CompilerServices.TaskAwaiter<int>.IsCompleted.get""
IL_0045: brtrue.s IL_0087
IL_0047: ldarg.0
IL_0048: ldc.i4.0
IL_0049: dup
IL_004a: stloc.0
IL_004b: stfld ""int Test.<F>d__2.<>1__state""
<IL_0050: ldarg.0
IL_0051: ldloc.2
IL_0052: stfld ""System.Runtime.CompilerServices.TaskAwaiter<int> Test.<F>d__2.<>u__1""
IL_0057: ldarg.0
IL_0058: stloc.3
IL_0008: brfalse.s IL_000c
IL_000a: br.s IL_000e
IL_000c: br.s IL_006d
-IL_000e: nop
-IL_000f: ldarg.0
IL_0010: ldc.i4.s 10
IL_0012: newarr ""S""
IL_0017: stfld ""S[] Test.<F>d__2.<array>5__1""
-IL_001c: ldarg.0
IL_001d: ldarg.0
IL_001e: ldfld ""S[] Test.<F>d__2.<array>5__1""
IL_0023: stfld ""S[] Test.<F>d__2.<>s__3""
IL_0028: ldarg.0
IL_0029: ldfld ""S[] Test.<F>d__2.<>s__3""
IL_002e: ldc.i4.1
IL_002f: ldelema ""S""
IL_0034: pop
IL_0035: call ""System.Threading.Tasks.Task<int> Test.G()""
IL_003a: callvirt ""System.Runtime.CompilerServices.TaskAwaiter<int> System.Threading.Tasks.Task<int>.GetAwaiter()""
IL_003f: stloc.2
~IL_0040: ldloca.s V_2
IL_0042: call ""bool System.Runtime.CompilerServices.TaskAwaiter<int>.IsCompleted.get""
IL_0047: brtrue.s IL_0089
IL_0049: ldarg.0
IL_004a: ldc.i4.0
IL_004b: dup
IL_004c: stloc.0
IL_004d: stfld ""int Test.<F>d__2.<>1__state""
<IL_0052: ldarg.0
IL_0053: ldloc.2
IL_0054: stfld ""System.Runtime.CompilerServices.TaskAwaiter<int> Test.<F>d__2.<>u__1""
IL_0059: ldarg.0
IL_005a: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<F>d__2.<>t__builder""
IL_005f: ldloca.s V_2
IL_0061: ldloca.s V_3
IL_0063: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.AwaitUnsafeOnCompleted<System.Runtime.CompilerServices.TaskAwaiter<int>, Test.<F>d__2>(ref System.Runtime.CompilerServices.TaskAwaiter<int>, ref Test.<F>d__2)""
IL_0068: nop
IL_0069: leave.s IL_00dd
>IL_006b: ldarg.0
IL_006c: ldfld ""System.Runtime.CompilerServices.TaskAwaiter<int> Test.<F>d__2.<>u__1""
IL_0071: stloc.2
IL_0072: ldarg.0
IL_0073: ldflda ""System.Runtime.CompilerServices.TaskAwaiter<int> Test.<F>d__2.<>u__1""
IL_0078: initobj ""System.Runtime.CompilerServices.TaskAwaiter<int>""
IL_007e: ldarg.0
IL_007f: ldc.i4.m1
IL_0080: dup
IL_0081: stloc.0
IL_0082: stfld ""int Test.<F>d__2.<>1__state""
IL_0087: ldarg.0
IL_0088: ldloca.s V_2
IL_008a: call ""int System.Runtime.CompilerServices.TaskAwaiter<int>.GetResult()""
IL_008f: stfld ""int Test.<F>d__2.<>s__2""
IL_0094: ldarg.0
IL_0095: ldfld ""S[] Test.<F>d__2.<>s__3""
IL_009a: ldc.i4.1
IL_009b: ldelema ""S""
IL_00a0: ldarg.0
IL_00a1: ldfld ""int Test.<F>d__2.<>s__2""
IL_00a6: call ""int S.Mutate(int)""
IL_00ab: stloc.1
IL_00ac: leave.s IL_00c8
IL_005a: stloc.3
IL_005b: ldarg.0
IL_005c: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<F>d__2.<>t__builder""
IL_0061: ldloca.s V_2
IL_0063: ldloca.s V_3
IL_0065: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.AwaitUnsafeOnCompleted<System.Runtime.CompilerServices.TaskAwaiter<int>, Test.<F>d__2>(ref System.Runtime.CompilerServices.TaskAwaiter<int>, ref Test.<F>d__2)""
IL_006a: nop
IL_006b: leave.s IL_00df
>IL_006d: ldarg.0
IL_006e: ldfld ""System.Runtime.CompilerServices.TaskAwaiter<int> Test.<F>d__2.<>u__1""
IL_0073: stloc.2
IL_0074: ldarg.0
IL_0075: ldflda ""System.Runtime.CompilerServices.TaskAwaiter<int> Test.<F>d__2.<>u__1""
IL_007a: initobj ""System.Runtime.CompilerServices.TaskAwaiter<int>""
IL_0080: ldarg.0
IL_0081: ldc.i4.m1
IL_0082: dup
IL_0083: stloc.0
IL_0084: stfld ""int Test.<F>d__2.<>1__state""
IL_0089: ldarg.0
IL_008a: ldloca.s V_2
IL_008c: call ""int System.Runtime.CompilerServices.TaskAwaiter<int>.GetResult()""
IL_0091: stfld ""int Test.<F>d__2.<>s__2""
IL_0096: ldarg.0
IL_0097: ldfld ""S[] Test.<F>d__2.<>s__3""
IL_009c: ldc.i4.1
IL_009d: ldelema ""S""
IL_00a2: ldarg.0
IL_00a3: ldfld ""int Test.<F>d__2.<>s__2""
IL_00a8: call ""int S.Mutate(int)""
IL_00ad: stloc.1
IL_00ae: leave.s IL_00ca
}
catch System.Exception
{
~IL_00ae: stloc.s V_4
IL_00b0: ldarg.0
IL_00b1: ldc.i4.s -2
IL_00b3: stfld ""int Test.<F>d__2.<>1__state""
IL_00b8: ldarg.0
IL_00b9: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<F>d__2.<>t__builder""
IL_00be: ldloc.s V_4
IL_00c0: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.SetException(System.Exception)""
IL_00c5: nop
IL_00c6: leave.s IL_00dd
~IL_00b0: stloc.s V_4
IL_00b2: ldarg.0
IL_00b3: ldc.i4.s -2
IL_00b5: stfld ""int Test.<F>d__2.<>1__state""
IL_00ba: ldarg.0
IL_00bb: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<F>d__2.<>t__builder""
IL_00c0: ldloc.s V_4
IL_00c2: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.SetException(System.Exception)""
IL_00c7: nop
IL_00c8: leave.s IL_00df
}
-IL_00c8: ldarg.0
IL_00c9: ldc.i4.s -2
IL_00cb: stfld ""int Test.<F>d__2.<>1__state""
~IL_00d0: ldarg.0
IL_00d1: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<F>d__2.<>t__builder""
IL_00d6: ldloc.1
IL_00d7: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.SetResult(int)""
IL_00dc: nop
IL_00dd: ret
-IL_00ca: ldarg.0
IL_00cb: ldc.i4.s -2
IL_00cd: stfld ""int Test.<F>d__2.<>1__state""
~IL_00d2: ldarg.0
IL_00d3: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<F>d__2.<>t__builder""
IL_00d8: ldloc.1
IL_00d9: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.SetResult(int)""
IL_00de: nop
IL_00df: ret
}",
sequencePoints: "Test+<F>d__2.MoveNext");
}
......@@ -4800,7 +4794,6 @@ class C
Diagnostic(ErrorCode.ERR_MissingPredefinedMember, "{ await task; }").WithArguments("System.Runtime.CompilerServices.IAsyncStateMachine", "SetStateMachine").WithLocation(62, 37));
}
[Fact, WorkItem(16531, "https://github.com/dotnet/roslyn/issues/16531")]
public void ArityMismatch()
{
......
......@@ -3263,72 +3263,74 @@ public IEnumerable<int> F()
v0.VerifyIL("C.<F>d__0.System.Collections.IEnumerator.MoveNext", @"
{
// Code size 127 (0x7f)
// Code size 131 (0x83)
.maxstack 2
.locals init (int V_0)
IL_0000: ldarg.0
IL_0001: ldfld ""int C.<F>d__0.<>1__state""
IL_0006: stloc.0
IL_0007: ldloc.0
IL_0008: brfalse.s IL_0014
IL_0008: brfalse.s IL_0012
IL_000a: br.s IL_000c
IL_000c: ldloc.0
IL_000d: ldc.i4.1
IL_000e: beq.s IL_0076
IL_0010: br.s IL_0012
IL_0012: ldc.i4.0
IL_0013: ret
IL_0014: ldarg.0
IL_0015: ldc.i4.m1
IL_0016: stfld ""int C.<F>d__0.<>1__state""
IL_001b: nop
IL_001c: ldarg.0
IL_001d: ldarg.0
IL_001e: ldfld ""C C.<F>d__0.<>4__this""
IL_0023: call ""System.Collections.Generic.IEnumerable<int> C.F()""
IL_0028: stfld ""System.Collections.Generic.IEnumerable<int> C.<F>d__0.<>s__1""
IL_002d: ldarg.0
IL_002e: ldc.i4.0
IL_002f: stfld ""bool C.<F>d__0.<>s__2""
IL_000e: beq.s IL_0014
IL_0010: br.s IL_0016
IL_0012: br.s IL_0018
IL_0014: br.s IL_007a
IL_0016: ldc.i4.0
IL_0017: ret
IL_0018: ldarg.0
IL_0019: ldc.i4.m1
IL_001a: stfld ""int C.<F>d__0.<>1__state""
IL_001f: nop
IL_0020: ldarg.0
IL_0021: ldarg.0
IL_0022: ldfld ""C C.<F>d__0.<>4__this""
IL_0027: call ""System.Collections.Generic.IEnumerable<int> C.F()""
IL_002c: stfld ""System.Collections.Generic.IEnumerable<int> C.<F>d__0.<>s__1""
IL_0031: ldarg.0
IL_0032: ldc.i4.0
IL_0033: stfld ""bool C.<F>d__0.<>s__2""
.try
{
IL_0034: ldarg.0
IL_0035: ldfld ""System.Collections.Generic.IEnumerable<int> C.<F>d__0.<>s__1""
IL_003a: ldarg.0
IL_003b: ldflda ""bool C.<F>d__0.<>s__2""
IL_0040: call ""void System.Threading.Monitor.Enter(object, ref bool)""
IL_0045: nop
IL_0046: nop
IL_0047: nop
IL_0048: leave.s IL_005f
IL_0038: ldarg.0
IL_0039: ldfld ""System.Collections.Generic.IEnumerable<int> C.<F>d__0.<>s__1""
IL_003e: ldarg.0
IL_003f: ldflda ""bool C.<F>d__0.<>s__2""
IL_0044: call ""void System.Threading.Monitor.Enter(object, ref bool)""
IL_0049: nop
IL_004a: nop
IL_004b: nop
IL_004c: leave.s IL_0063
}
finally
{
IL_004a: ldarg.0
IL_004b: ldfld ""bool C.<F>d__0.<>s__2""
IL_0050: brfalse.s IL_005e
IL_0052: ldarg.0
IL_0053: ldfld ""System.Collections.Generic.IEnumerable<int> C.<F>d__0.<>s__1""
IL_0058: call ""void System.Threading.Monitor.Exit(object)""
IL_005d: nop
IL_005e: endfinally
IL_004e: ldarg.0
IL_004f: ldfld ""bool C.<F>d__0.<>s__2""
IL_0054: brfalse.s IL_0062
IL_0056: ldarg.0
IL_0057: ldfld ""System.Collections.Generic.IEnumerable<int> C.<F>d__0.<>s__1""
IL_005c: call ""void System.Threading.Monitor.Exit(object)""
IL_0061: nop
IL_0062: endfinally
}
IL_005f: ldarg.0
IL_0060: ldnull
IL_0061: stfld ""System.Collections.Generic.IEnumerable<int> C.<F>d__0.<>s__1""
IL_0066: ldarg.0
IL_0067: ldc.i4.1
IL_0068: stfld ""int C.<F>d__0.<>2__current""
IL_006d: ldarg.0
IL_006e: ldc.i4.1
IL_006f: stfld ""int C.<F>d__0.<>1__state""
IL_0074: ldc.i4.1
IL_0075: ret
IL_0076: ldarg.0
IL_0077: ldc.i4.m1
IL_0078: stfld ""int C.<F>d__0.<>1__state""
IL_007d: ldc.i4.0
IL_007e: ret
IL_0063: ldarg.0
IL_0064: ldnull
IL_0065: stfld ""System.Collections.Generic.IEnumerable<int> C.<F>d__0.<>s__1""
IL_006a: ldarg.0
IL_006b: ldc.i4.1
IL_006c: stfld ""int C.<F>d__0.<>2__current""
IL_0071: ldarg.0
IL_0072: ldc.i4.1
IL_0073: stfld ""int C.<F>d__0.<>1__state""
IL_0078: ldc.i4.1
IL_0079: ret
IL_007a: ldarg.0
IL_007b: ldc.i4.m1
IL_007c: stfld ""int C.<F>d__0.<>1__state""
IL_0081: ldc.i4.0
IL_0082: ret
}");
#if TODO
......@@ -3370,7 +3372,7 @@ public async Task<int> F()
v0.VerifyIL("C.<F>d__0.System.Runtime.CompilerServices.IAsyncStateMachine.MoveNext", @"
{
// Code size 244 (0xf4)
// Code size 246 (0xf6)
.maxstack 3
.locals init (int V_0,
int V_1,
......@@ -3383,111 +3385,112 @@ .maxstack 3
.try
{
~IL_0007: ldloc.0
IL_0008: brfalse IL_009c
IL_000d: br.s IL_000f
-IL_000f: nop
-IL_0010: ldarg.0
IL_0011: ldarg.0
IL_0012: ldfld ""C C.<F>d__0.<>4__this""
IL_0017: call ""System.Threading.Tasks.Task<int> C.F()""
IL_001c: stfld ""System.Threading.Tasks.Task<int> C.<F>d__0.<>s__1""
IL_0021: ldarg.0
IL_0022: ldc.i4.0
IL_0023: stfld ""bool C.<F>d__0.<>s__2""
IL_0008: brfalse.s IL_000c
IL_000a: br.s IL_0011
IL_000c: br IL_009e
-IL_0011: nop
-IL_0012: ldarg.0
IL_0013: ldarg.0
IL_0014: ldfld ""C C.<F>d__0.<>4__this""
IL_0019: call ""System.Threading.Tasks.Task<int> C.F()""
IL_001e: stfld ""System.Threading.Tasks.Task<int> C.<F>d__0.<>s__1""
IL_0023: ldarg.0
IL_0024: ldc.i4.0
IL_0025: stfld ""bool C.<F>d__0.<>s__2""
.try
{
IL_0028: ldarg.0
IL_0029: ldfld ""System.Threading.Tasks.Task<int> C.<F>d__0.<>s__1""
IL_002e: ldarg.0
IL_002f: ldflda ""bool C.<F>d__0.<>s__2""
IL_0034: call ""void System.Threading.Monitor.Enter(object, ref bool)""
IL_0039: nop
-IL_003a: nop
-IL_003b: nop
IL_003c: leave.s IL_0057
IL_002a: ldarg.0
IL_002b: ldfld ""System.Threading.Tasks.Task<int> C.<F>d__0.<>s__1""
IL_0030: ldarg.0
IL_0031: ldflda ""bool C.<F>d__0.<>s__2""
IL_0036: call ""void System.Threading.Monitor.Enter(object, ref bool)""
IL_003b: nop
-IL_003c: nop
-IL_003d: nop
IL_003e: leave.s IL_0059
}
finally
{
~IL_003e: ldloc.0
IL_003f: ldc.i4.0
IL_0040: bge.s IL_0056
IL_0042: ldarg.0
IL_0043: ldfld ""bool C.<F>d__0.<>s__2""
IL_0048: brfalse.s IL_0056
IL_004a: ldarg.0
IL_004b: ldfld ""System.Threading.Tasks.Task<int> C.<F>d__0.<>s__1""
IL_0050: call ""void System.Threading.Monitor.Exit(object)""
IL_0055: nop
~IL_0056: endfinally
~IL_0040: ldloc.0
IL_0041: ldc.i4.0
IL_0042: bge.s IL_0058
IL_0044: ldarg.0
IL_0045: ldfld ""bool C.<F>d__0.<>s__2""
IL_004a: brfalse.s IL_0058
IL_004c: ldarg.0
IL_004d: ldfld ""System.Threading.Tasks.Task<int> C.<F>d__0.<>s__1""
IL_0052: call ""void System.Threading.Monitor.Exit(object)""
IL_0057: nop
~IL_0058: endfinally
}
~IL_0057: ldarg.0
IL_0058: ldnull
IL_0059: stfld ""System.Threading.Tasks.Task<int> C.<F>d__0.<>s__1""
-IL_005e: ldarg.0
IL_005f: ldfld ""C C.<F>d__0.<>4__this""
IL_0064: call ""System.Threading.Tasks.Task<int> C.F()""
IL_0069: callvirt ""System.Runtime.CompilerServices.TaskAwaiter<int> System.Threading.Tasks.Task<int>.GetAwaiter()""
IL_006e: stloc.2
~IL_006f: ldloca.s V_2
IL_0071: call ""bool System.Runtime.CompilerServices.TaskAwaiter<int>.IsCompleted.get""
IL_0076: brtrue.s IL_00b8
IL_0078: ldarg.0
IL_0079: ldc.i4.0
IL_007a: dup
IL_007b: stloc.0
IL_007c: stfld ""int C.<F>d__0.<>1__state""
<IL_0081: ldarg.0
IL_0082: ldloc.2
IL_0083: stfld ""System.Runtime.CompilerServices.TaskAwaiter<int> C.<F>d__0.<>u__1""
IL_0088: ldarg.0
IL_0089: stloc.3
~IL_0059: ldarg.0
IL_005a: ldnull
IL_005b: stfld ""System.Threading.Tasks.Task<int> C.<F>d__0.<>s__1""
-IL_0060: ldarg.0
IL_0061: ldfld ""C C.<F>d__0.<>4__this""
IL_0066: call ""System.Threading.Tasks.Task<int> C.F()""
IL_006b: callvirt ""System.Runtime.CompilerServices.TaskAwaiter<int> System.Threading.Tasks.Task<int>.GetAwaiter()""
IL_0070: stloc.2
~IL_0071: ldloca.s V_2
IL_0073: call ""bool System.Runtime.CompilerServices.TaskAwaiter<int>.IsCompleted.get""
IL_0078: brtrue.s IL_00ba
IL_007a: ldarg.0
IL_007b: ldc.i4.0
IL_007c: dup
IL_007d: stloc.0
IL_007e: stfld ""int C.<F>d__0.<>1__state""
<IL_0083: ldarg.0
IL_0084: ldloc.2
IL_0085: stfld ""System.Runtime.CompilerServices.TaskAwaiter<int> C.<F>d__0.<>u__1""
IL_008a: ldarg.0
IL_008b: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> C.<F>d__0.<>t__builder""
IL_0090: ldloca.s V_2
IL_0092: ldloca.s V_3
IL_0094: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.AwaitUnsafeOnCompleted<System.Runtime.CompilerServices.TaskAwaiter<int>, C.<F>d__0>(ref System.Runtime.CompilerServices.TaskAwaiter<int>, ref C.<F>d__0)""
IL_0099: nop
IL_009a: leave.s IL_00f3
>IL_009c: ldarg.0
IL_009d: ldfld ""System.Runtime.CompilerServices.TaskAwaiter<int> C.<F>d__0.<>u__1""
IL_00a2: stloc.2
IL_00a3: ldarg.0
IL_00a4: ldflda ""System.Runtime.CompilerServices.TaskAwaiter<int> C.<F>d__0.<>u__1""
IL_00a9: initobj ""System.Runtime.CompilerServices.TaskAwaiter<int>""
IL_00af: ldarg.0
IL_00b0: ldc.i4.m1
IL_00b1: dup
IL_00b2: stloc.0
IL_00b3: stfld ""int C.<F>d__0.<>1__state""
IL_00b8: ldloca.s V_2
IL_00ba: call ""int System.Runtime.CompilerServices.TaskAwaiter<int>.GetResult()""
IL_00bf: pop
-IL_00c0: ldc.i4.1
IL_00c1: stloc.1
IL_00c2: leave.s IL_00de
IL_008b: stloc.3
IL_008c: ldarg.0
IL_008d: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> C.<F>d__0.<>t__builder""
IL_0092: ldloca.s V_2
IL_0094: ldloca.s V_3
IL_0096: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.AwaitUnsafeOnCompleted<System.Runtime.CompilerServices.TaskAwaiter<int>, C.<F>d__0>(ref System.Runtime.CompilerServices.TaskAwaiter<int>, ref C.<F>d__0)""
IL_009b: nop
IL_009c: leave.s IL_00f5
>IL_009e: ldarg.0
IL_009f: ldfld ""System.Runtime.CompilerServices.TaskAwaiter<int> C.<F>d__0.<>u__1""
IL_00a4: stloc.2
IL_00a5: ldarg.0
IL_00a6: ldflda ""System.Runtime.CompilerServices.TaskAwaiter<int> C.<F>d__0.<>u__1""
IL_00ab: initobj ""System.Runtime.CompilerServices.TaskAwaiter<int>""
IL_00b1: ldarg.0
IL_00b2: ldc.i4.m1
IL_00b3: dup
IL_00b4: stloc.0
IL_00b5: stfld ""int C.<F>d__0.<>1__state""
IL_00ba: ldloca.s V_2
IL_00bc: call ""int System.Runtime.CompilerServices.TaskAwaiter<int>.GetResult()""
IL_00c1: pop
-IL_00c2: ldc.i4.1
IL_00c3: stloc.1
IL_00c4: leave.s IL_00e0
}
catch System.Exception
{
~IL_00c4: stloc.s V_4
IL_00c6: ldarg.0
IL_00c7: ldc.i4.s -2
IL_00c9: stfld ""int C.<F>d__0.<>1__state""
IL_00ce: ldarg.0
IL_00cf: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> C.<F>d__0.<>t__builder""
IL_00d4: ldloc.s V_4
IL_00d6: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.SetException(System.Exception)""
IL_00db: nop
IL_00dc: leave.s IL_00f3
~IL_00c6: stloc.s V_4
IL_00c8: ldarg.0
IL_00c9: ldc.i4.s -2
IL_00cb: stfld ""int C.<F>d__0.<>1__state""
IL_00d0: ldarg.0
IL_00d1: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> C.<F>d__0.<>t__builder""
IL_00d6: ldloc.s V_4
IL_00d8: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.SetException(System.Exception)""
IL_00dd: nop
IL_00de: leave.s IL_00f5
}
-IL_00de: ldarg.0
IL_00df: ldc.i4.s -2
IL_00e1: stfld ""int C.<F>d__0.<>1__state""
~IL_00e6: ldarg.0
IL_00e7: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> C.<F>d__0.<>t__builder""
IL_00ec: ldloc.1
IL_00ed: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.SetResult(int)""
IL_00f2: nop
IL_00f3: ret
-IL_00e0: ldarg.0
IL_00e1: ldc.i4.s -2
IL_00e3: stfld ""int C.<F>d__0.<>1__state""
~IL_00e8: ldarg.0
IL_00e9: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> C.<F>d__0.<>t__builder""
IL_00ee: ldloc.1
IL_00ef: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.SetResult(int)""
IL_00f4: nop
IL_00f5: ret
}", sequencePoints: "C+<F>d__0.MoveNext");
#if TODO
......
......@@ -426,7 +426,7 @@ IEnumerable<int> M()
<namespace usingCount=""1"" />
</using>
<hoistedLocalScopes>
<slot startOffset=""0x1c"" endOffset=""0x63"" />
<slot startOffset=""0x20"" endOffset=""0x67"" />
</hoistedLocalScopes>
<encLocalSlotMap>
<slot kind=""27"" offset=""0"" />
......@@ -436,23 +436,23 @@ IEnumerable<int> M()
</customDebugInfo>
<sequencePoints>
<entry offset=""0x0"" hidden=""true"" document=""1"" />
<entry offset=""0x1b"" startLine=""7"" startColumn=""5"" endLine=""7"" endColumn=""6"" document=""1"" />
<entry offset=""0x1c"" startLine=""9"" startColumn=""14"" endLine=""9"" endColumn=""23"" document=""1"" />
<entry offset=""0x23"" hidden=""true"" document=""1"" />
<entry offset=""0x25"" startLine=""10"" startColumn=""9"" endLine=""10"" endColumn=""10"" document=""1"" />
<entry offset=""0x26"" startLine=""12"" startColumn=""13"" endLine=""12"" endColumn=""36"" document=""1"" />
<entry offset=""0x3d"" hidden=""true"" document=""1"" />
<entry offset=""0x44"" startLine=""13"" startColumn=""9"" endLine=""13"" endColumn=""10"" document=""1"" />
<entry offset=""0x45"" startLine=""9"" startColumn=""33"" endLine=""9"" endColumn=""36"" document=""1"" />
<entry offset=""0x55"" startLine=""9"" startColumn=""25"" endLine=""9"" endColumn=""31"" document=""1"" />
<entry offset=""0x60"" hidden=""true"" document=""1"" />
<entry offset=""0x63"" startLine=""14"" startColumn=""5"" endLine=""14"" endColumn=""6"" document=""1"" />
<entry offset=""0x1f"" startLine=""7"" startColumn=""5"" endLine=""7"" endColumn=""6"" document=""1"" />
<entry offset=""0x20"" startLine=""9"" startColumn=""14"" endLine=""9"" endColumn=""23"" document=""1"" />
<entry offset=""0x27"" hidden=""true"" document=""1"" />
<entry offset=""0x29"" startLine=""10"" startColumn=""9"" endLine=""10"" endColumn=""10"" document=""1"" />
<entry offset=""0x2a"" startLine=""12"" startColumn=""13"" endLine=""12"" endColumn=""36"" document=""1"" />
<entry offset=""0x41"" hidden=""true"" document=""1"" />
<entry offset=""0x48"" startLine=""13"" startColumn=""9"" endLine=""13"" endColumn=""10"" document=""1"" />
<entry offset=""0x49"" startLine=""9"" startColumn=""33"" endLine=""9"" endColumn=""36"" document=""1"" />
<entry offset=""0x59"" startLine=""9"" startColumn=""25"" endLine=""9"" endColumn=""31"" document=""1"" />
<entry offset=""0x64"" hidden=""true"" document=""1"" />
<entry offset=""0x67"" startLine=""14"" startColumn=""5"" endLine=""14"" endColumn=""6"" document=""1"" />
</sequencePoints>
<scope startOffset=""0x0"" endOffset=""0x65"">
<scope startOffset=""0x0"" endOffset=""0x69"">
<namespace name=""System.Collections.Generic"" />
<scope startOffset=""0x1b"" endOffset=""0x65"">
<scope startOffset=""0x1f"" endOffset=""0x69"">
<constant name=""x"" value=""1"" type=""Int32"" />
<scope startOffset=""0x25"" endOffset=""0x45"">
<scope startOffset=""0x29"" endOffset=""0x49"">
<constant name=""y"" value=""2"" type=""Int32"" />
</scope>
</scope>
......
......@@ -7135,9 +7135,9 @@ static IEnumerable<object> F()
<customDebugInfo>
<forward declaringType=""C+&lt;&gt;c"" methodName=""&lt;F&gt;b__0_0"" parameterNames=""i"" />
<hoistedLocalScopes>
<slot startOffset=""0x23"" endOffset=""0xd1"" />
<slot startOffset=""0x27"" endOffset=""0xd5"" />
<slot />
<slot startOffset=""0x7b"" endOffset=""0xb2"" />
<slot startOffset=""0x7f"" endOffset=""0xb6"" />
</hoistedLocalScopes>
<encLocalSlotMap>
<slot kind=""temp"" />
......@@ -7146,19 +7146,19 @@ static IEnumerable<object> F()
</customDebugInfo>
<sequencePoints>
<entry offset=""0x0"" hidden=""true"" document=""1"" />
<entry offset=""0x23"" startLine=""6"" startColumn=""5"" endLine=""6"" endColumn=""6"" document=""1"" />
<entry offset=""0x24"" startLine=""7"" startColumn=""9"" endLine=""7"" endColumn=""35"" document=""1"" />
<entry offset=""0x3b"" startLine=""8"" startColumn=""9"" endLine=""8"" endColumn=""16"" document=""1"" />
<entry offset=""0x3c"" startLine=""8"" startColumn=""27"" endLine=""8"" endColumn=""43"" document=""1"" />
<entry offset=""0x79"" hidden=""true"" document=""1"" />
<entry offset=""0x7b"" startLine=""8"" startColumn=""18"" endLine=""8"" endColumn=""23"" document=""1"" />
<entry offset=""0x8c"" startLine=""9"" startColumn=""9"" endLine=""9"" endColumn=""10"" document=""1"" />
<entry offset=""0x8d"" startLine=""10"" startColumn=""13"" endLine=""10"" endColumn=""28"" document=""1"" />
<entry offset=""0xa9"" hidden=""true"" document=""1"" />
<entry offset=""0xb1"" startLine=""11"" startColumn=""9"" endLine=""11"" endColumn=""10"" document=""1"" />
<entry offset=""0xb2"" startLine=""8"" startColumn=""24"" endLine=""8"" endColumn=""26"" document=""1"" />
<entry offset=""0xcd"" startLine=""12"" startColumn=""5"" endLine=""12"" endColumn=""6"" document=""1"" />
<entry offset=""0xd1"" hidden=""true"" document=""1"" />
<entry offset=""0x27"" startLine=""6"" startColumn=""5"" endLine=""6"" endColumn=""6"" document=""1"" />
<entry offset=""0x28"" startLine=""7"" startColumn=""9"" endLine=""7"" endColumn=""35"" document=""1"" />
<entry offset=""0x3f"" startLine=""8"" startColumn=""9"" endLine=""8"" endColumn=""16"" document=""1"" />
<entry offset=""0x40"" startLine=""8"" startColumn=""27"" endLine=""8"" endColumn=""43"" document=""1"" />
<entry offset=""0x7d"" hidden=""true"" document=""1"" />
<entry offset=""0x7f"" startLine=""8"" startColumn=""18"" endLine=""8"" endColumn=""23"" document=""1"" />
<entry offset=""0x90"" startLine=""9"" startColumn=""9"" endLine=""9"" endColumn=""10"" document=""1"" />
<entry offset=""0x91"" startLine=""10"" startColumn=""13"" endLine=""10"" endColumn=""28"" document=""1"" />
<entry offset=""0xad"" hidden=""true"" document=""1"" />
<entry offset=""0xb5"" startLine=""11"" startColumn=""9"" endLine=""11"" endColumn=""10"" document=""1"" />
<entry offset=""0xb6"" startLine=""8"" startColumn=""24"" endLine=""8"" endColumn=""26"" document=""1"" />
<entry offset=""0xd1"" startLine=""12"" startColumn=""5"" endLine=""12"" endColumn=""6"" document=""1"" />
<entry offset=""0xd5"" hidden=""true"" document=""1"" />
</sequencePoints>
</method>
</methods>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册