2 using System.Threading.Tasks;
6 static async Task<int> YieldValue (int a)
12 static async Task<int> TestNestedReturn (int v)
18 x = await YieldValue (1);
19 Console.WriteLine ("T1");
23 Console.WriteLine ("F1");
25 x += await YieldValue (2);
28 Console.WriteLine ("AF1");
30 Console.WriteLine ("F2");
32 x += await YieldValue (4);
33 Console.WriteLine ("T3");
35 Console.WriteLine ("F3");
36 x += await YieldValue (8);
40 Console.WriteLine ("END");
45 static async Task<int> TestNestedGoto (int v)
51 Console.WriteLine ("T1");
55 x = await YieldValue (1);
57 Console.WriteLine ("F1");
59 x += await YieldValue (2);
62 Console.WriteLine ("AF1");
64 Console.WriteLine ("F2");
66 x += await YieldValue (4);
67 Console.WriteLine ("T3");
69 Console.WriteLine ("F3");
70 x += await YieldValue (8);
74 Console.WriteLine ("END");
76 Console.WriteLine ("END L");
81 public static int Main ()
83 if (TestNestedReturn (1).Result != 6)
86 if (TestNestedReturn (0).Result != 15)
89 if (TestNestedGoto (1).Result != 15)
92 if (TestNestedGoto (0).Result != 14)