Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(433)

Side by Side Diff: tests/compiler/dart2js/async_await_syntax.dart

Issue 675113002: Support async/await in the dart2js frontend. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 // Test async/await syntax.
6
7 var yield = 0;
8 var await = 0;
9
10 a01a() async => null; /// a01a: ok
11 a01b() async* => null; /// a01b: compile-time error
12 a01c() sync* => null; /// a01c: compile-time error
13 a02a() async {} /// a02a: ok
14 a03a() async* {} /// a03a: ok
15 a03b() async * {} /// a03b: compile-time error
16 a04a() sync* {} /// a04a: ok
17 a04b() sync {} /// a04b: compile-time error
18 a04c() sync * {} /// a04c: compile-time error
19 a05a() async { await 0; } /// a05a: ok
20 a05b() async { /// a05b: ok
21 await(a) {}; /// a05b: continued
22 await(0); /// a05b: continued
23 } /// a05b: continued
24 a05c() { /// a05c: ok
25 await(a) {}; /// a05c: continued
26 await(0); /// a05c: continued
27 } /// a05c: continued
28 a05d() async { /// a05d: compile-time error
29 await(a) {} /// a05d: continued
30 await(0); /// a05d: continued
31 } /// a05d: continued
32 a05e() { /// a05e: ok
33 await(a) {} /// a05e: continued
34 await(0); /// a05e: continued
35 } /// a05e: continued
36 a05f() async { /// a05f: compile-time error
37 var await = (a) {}; /// a05f: continued
38 await(0); /// a05f: continued
39 } /// a05f: continued
40 a06a() async { await for (var o in []) {} } /// a06a: ok
41 a06b() sync* { await for (var o in []) {} } /// a06b: compile-time error
42 a07a() sync* { yield 0; } /// a07a: ok
43 a07b() sync { yield 0; } /// a07b: compile-time error
44 a08a() sync* { yield* []; } /// a08a: ok
45 a08b() sync { yield 0; } /// a08b: compile-time error
46 a09a() async* { yield 0; } /// a09a: ok
47 a10a() async* { yield* []; } /// a10a: ok
48
49 abstract class B {
50 b00a() async; /// b00a: compile-time error
51 b00b() async*; /// b00b: compile-time error
52 b00c() sync*; /// b00c: compile-time error
53 b00d() sync; /// b00d: compile-time error
54 }
55
56 class C extends B {
57 C();
58
59 factory C.e1() async { return null; } /// e1: compile-time error
60 factory C.e2() async* { return null; } /// e2: compile-time error
61 factory C.e3() sync* { return null; } /// e3: compile-time error
62 factory C.e4() async = C; /// e4: compile-time error
63 factory C.e5() async* = C; /// e5: compile-time error
64 factory C.e6() sync* = C; /// e6: compile-time error
65 C.e7() async {} /// e7: compile-time error
66 C.e8() async* {} /// e8: compile-time error
67 C.e9() sync* {} /// e9: compile-time error
68
69 b00a() {} /// b00a: continued
70 b00b() {} /// b00b: continued
71 b00c() {} /// b00c: continued
72 b00d() {} /// b00d: continued
73
74 b01a() async => null; /// b01a: ok
75 b01b() async* => null; /// b01b: compile-time error
76 b01c() sync* => null; /// b01c: compile-time error
77 b02a() async {} /// b02a: ok
78 b03a() async* {} /// b03a: ok
79 b04a() sync* {} /// b04a: ok
80 b04b() sync {} /// b04b: compile-time error
81 b05a() async { await 0; } /// b05a: ok
82 b06a() async { await for (var o in []) {} } /// b06a: ok
83 b06b() async { await for ( ; ; ) {} } /// b06b: compile-time error
84 b07a() sync* { yield 0; } /// b07a: ok
85 b08a() sync* { yield* []; } /// b08a: ok
86 b09a() async* { yield 0; } /// b09a: ok
87 b10a() async* { yield* []; } /// b10a: ok
88 }
89
90 method1() {
91 c01a() async => null; c01a(); /// c01a: ok
92 c01b() async* => null; c01b(); /// c01b: compile-time er ror
93 c01c() sync* => null; c01c(); /// c01c: compile-time er ror
94 c02a() async {} c02a(); /// c02a: ok
95 c03a() async* {} c03a(); /// c03a: ok
96 c04a() sync* {} c04a(); /// c04a: ok
97 c04b() sync {} c04b(); /// c04b: compile-time er ror
98 c05a() async { await 0; } c05a(); /// c05a: ok
99 c06a() async { await for (var o in []) {} } c06a(); /// c06a: ok
100 c07a() sync* { yield 0; } c07a(); /// c07a: ok
101 c08a() sync* { yield* []; } c08a(); /// c08a: ok
102 c09a() async* { yield 0; } c09a(); /// c09a: ok
103 c10a() async* { yield* []; } c10a(); /// c10a: ok
104 }
105
106 method2() {
107 var d01a = () async => null; d01a(); /// d01a: ok
108 var d01b = () async* => null; d01b(); /// d01b: compile -time error
109 var d01c = () sync* => null; d01c(); /// d01c: compile -time error
110 var d02a = () async {}; d02a(); /// d02a: ok
111 var d03a = () async* {}; d03a(); /// d03a: ok
112 var d04a = () sync* {}; d04a(); /// d04a: ok
113 var d04b = () sync {}; d04b(); /// d04b: compile -time error
114 var d05a = () async { await 0; }; d05a(); /// d05a: ok
115 var d06a = () async { await for (var o in []) {} }; d06a(); /// d06a: ok
116 var d07a = () sync* { yield 0; }; d07a(); /// d07a: ok
117 var d08a = () sync* { yield* []; }; d08a(); /// d08a: ok
118 var d08b = () sync* { yield*0+1; }; d08b(); /// d08b: ok
119 var d08c = () { yield*0+1; }; d08c(); /// d08c: ok
120 var d09a = () async* { yield 0; }; d09a(); /// d09a: ok
121 var d10a = () async* { yield* []; }; d10a(); /// d10a: ok
122 }
123
124
125 void main() {
126 var c = new C();
127 c = new C.e1(); /// e1: continued
128 c = new C.e2(); /// e2: continued
129 c = new C.e3(); /// e3: continued
130 c = new C.e4(); /// e4: continued
131 c = new C.e5(); /// e5: continued
132 c = new C.e6(); /// e6: continued
133 c = new C.e7(); /// e7: continued
134 c = new C.e8(); /// e8: continued
135 c = new C.e9(); /// e9: continued
136
137 a01a(); /// a01a: continued
138 a01b(); /// a01b: continued
139 a01c(); /// a01c: continued
140 a02a(); /// a02a: continued
141 a03a(); /// a03a: continued
142 a03b(); /// a03b: continued
143 a04a(); /// a04a: continued
144 a04b(); /// a04b: continued
145 a04c(); /// a04c: continued
146 a05a(); /// a05a: continued
147 a05b(); /// a05b: continued
148 a05c(); /// a05c: continued
149 a05d(); /// a05d: continued
150 a05e(); /// a05e: continued
151 a05f(); /// a05f: continued
152 a06a(); /// a06a: continued
153 a06b(); /// a06b: continued
154 a07a(); /// a07a: continued
155 a07b(); /// a07b: continued
156 a08a(); /// a08a: continued
157 a08b(); /// a08b: continued
158 a09a(); /// a09a: continued
159 a10a(); /// a10a: continued
160
161 c.b00a(); /// b00a: continued
162 c.b00b(); /// b00b: continued
163 c.b00c(); /// b00c: continued
164 c.b00d(); /// b00d: continued
165 c.b01a(); /// b01a: continued
166 c.b01b(); /// b01b: continued
167 c.b01c(); /// b01c: continued
168 c.b02a(); /// b02a: continued
169 c.b03a(); /// b03a: continued
170 c.b04a(); /// b04a: continued
171 c.b04b(); /// b04b: continued
172 c.b05a(); /// b05a: continued
173 c.b06a(); /// b06a: continued
174 c.b06b(); /// b06b: continued
175 c.b07a(); /// b07a: continued
176 c.b08a(); /// b08a: continued
177 c.b09a(); /// b09a: continued
178 c.b10a(); /// b10a: continued
179
180 method1();
181 method2();
182 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/warnings.dart ('k') | tests/compiler/dart2js/async_await_syntax_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698