OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 // Test async/await syntax. | 5 // Test async/await syntax. |
6 | 6 |
7 import 'dart:async' show Stream; | 7 import 'dart:async' show Stream; |
8 | 8 |
9 var yield = 0; | 9 var yield = 0; |
10 var await = 0; | 10 var await = 0; |
11 get st => new Stream.fromIterable([]); | 11 get st => new Stream.fromIterable([]); |
12 | 12 |
13 a01a() async => null; /// a01a: ok | 13 a01a() async => null; /// a01a: ok |
14 a01b() async* => null; /// a01b: compile-time error | 14 a01b() async* => null; /// a01b: compile-time error |
15 a01c() sync* => null; /// a01c: compile-time error | 15 a01c() sync* => null; /// a01c: compile-time error |
16 a02a() async {} /// a02a: ok | 16 a02a() async {} /// a02a: ok |
17 a03a() async* {} /// a03a: ok | 17 a03a() async* {} /// a03a: ok |
18 a03b() async * {} /// a03b: compile-time error | 18 a03b() async * {} /// a03b: ok |
19 a04a() sync* {} /// a04a: ok | 19 a04a() sync* {} /// a04a: ok |
20 a04b() sync {} /// a04b: compile-time error | 20 a04b() sync {} /// a04b: compile-time error |
21 a04c() sync * {} /// a04c: compile-time error | 21 a04c() sync * {} /// a04c: ok |
22 a05a() async { await 0; } /// a05a: ok | 22 a05a() async { await 0; } /// a05a: ok |
23 a05b() async { /// a05b: ok | 23 a05b() async { /// a05b: ok |
24 await(a) {}; /// a05b: continued | 24 await(a) {}; /// a05b: continued |
25 await(0); /// a05b: continued | 25 await(0); /// a05b: continued |
26 } /// a05b: continued | 26 } /// a05b: continued |
27 a05c() { /// a05c: ok | 27 a05c() { /// a05c: ok |
28 await(a) {}; /// a05c: continued | 28 await(a) {}; /// a05c: continued |
29 await(0); /// a05c: continued | 29 await(0); /// a05c: continued |
30 } /// a05c: continued | 30 } /// a05c: continued |
31 a05d() async { /// a05d: compile-time error | 31 a05d() async { /// a05d: compile-time error |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 a = c.async; /// b14c: continued | 267 a = c.async; /// b14c: continued |
268 a = c.async; /// b14d: continued | 268 a = c.async; /// b14d: continued |
269 c.sync(); /// b15a: continued | 269 c.sync(); /// b15a: continued |
270 c.sync(); /// b15b: continued | 270 c.sync(); /// b15b: continued |
271 c.async(); /// b15c: continued | 271 c.async(); /// b15c: continued |
272 c.async(); /// b15d: continued | 272 c.async(); /// b15d: continued |
273 | 273 |
274 method1(); | 274 method1(); |
275 method2(); | 275 method2(); |
276 } | 276 } |
OLD | NEW |