| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 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 | 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 var yield = 0; | 7 var yield = 0; |
| 8 var await = 0; | 8 var await = 0; |
| 9 | 9 |
| 10 a01a() async => null; /// a01a: ok | 10 a01a() async => null; /// a01a: ok |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 } /// a05f: continued | 39 } /// a05f: continued |
| 40 a06a() async { await for (var o in []) {} } /// a06a: ok | 40 a06a() async { await for (var o in []) {} } /// a06a: ok |
| 41 a06b() sync* { await for (var o in []) {} } /// a06b: compile-time error | 41 a06b() sync* { await for (var o in []) {} } /// a06b: compile-time error |
| 42 a07a() sync* { yield 0; } /// a07a: ok | 42 a07a() sync* { yield 0; } /// a07a: ok |
| 43 a07b() sync { yield 0; } /// a07b: compile-time error | 43 a07b() sync { yield 0; } /// a07b: compile-time error |
| 44 a08a() sync* { yield* []; } /// a08a: ok | 44 a08a() sync* { yield* []; } /// a08a: ok |
| 45 a08b() sync { yield 0; } /// a08b: compile-time error | 45 a08b() sync { yield 0; } /// a08b: compile-time error |
| 46 a09a() async* { yield 0; } /// a09a: ok | 46 a09a() async* { yield 0; } /// a09a: ok |
| 47 a10a() async* { yield* []; } /// a10a: ok | 47 a10a() async* { yield* []; } /// a10a: ok |
| 48 | 48 |
| 49 get sync sync {} /// a11a: compile-time error |
| 50 get sync sync* {} /// a11b: ok |
| 51 get async async {} /// a11c: ok |
| 52 get async async* {} /// a11d: ok |
| 53 |
| 54 get sync {} /// a12a: ok |
| 55 get sync* {} /// a12b: compile-time error |
| 56 get async {} /// a12c: ok |
| 57 get async* {} /// a12d: compile-time error |
| 58 |
| 59 int sync; /// a13a: ok |
| 60 int sync*; /// a13b: compile-time error |
| 61 int async; /// a13c: ok |
| 62 int async*; /// a13d: compile-time error |
| 63 |
| 64 var sync; /// a14a: ok |
| 65 var sync*; /// a14b: compile-time error |
| 66 var async; /// a14c: ok |
| 67 var async*; /// a14d: compile-time error |
| 68 |
| 69 sync() {} /// a15a: ok |
| 70 sync*() {} /// a15b: compile-time error |
| 71 async() {} /// a15c: ok |
| 72 async*() {} /// a15d: compile-time error |
| 73 |
| 49 abstract class B { | 74 abstract class B { |
| 50 b00a() async; /// b00a: compile-time error | 75 b00a() async; /// b00a: compile-time error |
| 51 b00b() async*; /// b00b: compile-time error | 76 b00b() async*; /// b00b: compile-time error |
| 52 b00c() sync*; /// b00c: compile-time error | 77 b00c() sync*; /// b00c: compile-time error |
| 53 b00d() sync; /// b00d: compile-time error | 78 b00d() sync; /// b00d: compile-time error |
| 54 } | 79 } |
| 55 | 80 |
| 56 class C extends B { | 81 class C extends B { |
| 57 C(); | 82 C(); |
| 58 | 83 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 78 b03a() async* {} /// b03a: ok | 103 b03a() async* {} /// b03a: ok |
| 79 b04a() sync* {} /// b04a: ok | 104 b04a() sync* {} /// b04a: ok |
| 80 b04b() sync {} /// b04b: compile-time error | 105 b04b() sync {} /// b04b: compile-time error |
| 81 b05a() async { await 0; } /// b05a: ok | 106 b05a() async { await 0; } /// b05a: ok |
| 82 b06a() async { await for (var o in []) {} } /// b06a: ok | 107 b06a() async { await for (var o in []) {} } /// b06a: ok |
| 83 b06b() async { await for ( ; ; ) {} } /// b06b: compile-time error | 108 b06b() async { await for ( ; ; ) {} } /// b06b: compile-time error |
| 84 b07a() sync* { yield 0; } /// b07a: ok | 109 b07a() sync* { yield 0; } /// b07a: ok |
| 85 b08a() sync* { yield* []; } /// b08a: ok | 110 b08a() sync* { yield* []; } /// b08a: ok |
| 86 b09a() async* { yield 0; } /// b09a: ok | 111 b09a() async* { yield 0; } /// b09a: ok |
| 87 b10a() async* { yield* []; } /// b10a: ok | 112 b10a() async* { yield* []; } /// b10a: ok |
| 113 |
| 114 get sync sync {} /// b11a: compile-time error |
| 115 get sync sync* {} /// b11b: ok |
| 116 get async async {} /// b11c: ok |
| 117 get async async* {} /// b11d: ok |
| 118 |
| 119 get sync {} /// b12a: ok |
| 120 get sync* {} /// b12b: compile-time error |
| 121 get async {} /// b12c: ok |
| 122 get async* {} /// b12d: compile-time error |
| 123 |
| 124 int sync; /// b13a: ok |
| 125 int sync*; /// b13b: compile-time error |
| 126 int async; /// b13c: ok |
| 127 int async*; /// b13d: compile-time error |
| 128 |
| 129 var sync; /// b14a: ok |
| 130 var sync*; /// b14b: compile-time error |
| 131 var async; /// b14c: ok |
| 132 var async*; /// b14d: compile-time error |
| 133 |
| 134 sync() {} /// b15a: ok |
| 135 sync*() {} /// b15b: compile-time error |
| 136 async() {} /// b15c: ok |
| 137 async*() {} /// b15d: compile-time error |
| 88 } | 138 } |
| 89 | 139 |
| 90 method1() { | 140 method1() { |
| 91 c01a() async => null; c01a(); /// c01a: ok | 141 c01a() async => null; c01a(); /// c01a: ok |
| 92 c01b() async* => null; c01b(); /// c01b: compile-time er
ror | 142 c01b() async* => null; c01b(); /// c01b: compile-time er
ror |
| 93 c01c() sync* => null; c01c(); /// c01c: compile-time er
ror | 143 c01c() sync* => null; c01c(); /// c01c: compile-time er
ror |
| 94 c02a() async {} c02a(); /// c02a: ok | 144 c02a() async {} c02a(); /// c02a: ok |
| 95 c03a() async* {} c03a(); /// c03a: ok | 145 c03a() async* {} c03a(); /// c03a: ok |
| 96 c04a() sync* {} c04a(); /// c04a: ok | 146 c04a() sync* {} c04a(); /// c04a: ok |
| 97 c04b() sync {} c04b(); /// c04b: compile-time er
ror | 147 c04b() sync {} c04b(); /// c04b: compile-time er
ror |
| (...skipping 18 matching lines...) Expand all Loading... |
| 116 var d07a = () sync* { yield 0; }; d07a(); /// d07a: ok | 166 var d07a = () sync* { yield 0; }; d07a(); /// d07a: ok |
| 117 var d08a = () sync* { yield* []; }; d08a(); /// d08a: ok | 167 var d08a = () sync* { yield* []; }; d08a(); /// d08a: ok |
| 118 var d08b = () sync* { yield*0+1; }; d08b(); /// d08b: ok | 168 var d08b = () sync* { yield*0+1; }; d08b(); /// d08b: ok |
| 119 var d08c = () { yield*0+1; }; d08c(); /// d08c: ok | 169 var d08c = () { yield*0+1; }; d08c(); /// d08c: ok |
| 120 var d09a = () async* { yield 0; }; d09a(); /// d09a: ok | 170 var d09a = () async* { yield 0; }; d09a(); /// d09a: ok |
| 121 var d10a = () async* { yield* []; }; d10a(); /// d10a: ok | 171 var d10a = () async* { yield* []; }; d10a(); /// d10a: ok |
| 122 } | 172 } |
| 123 | 173 |
| 124 | 174 |
| 125 void main() { | 175 void main() { |
| 176 var a; |
| 126 var c = new C(); | 177 var c = new C(); |
| 127 c = new C.e1(); /// e1: continued | 178 c = new C.e1(); /// e1: continued |
| 128 c = new C.e2(); /// e2: continued | 179 c = new C.e2(); /// e2: continued |
| 129 c = new C.e3(); /// e3: continued | 180 c = new C.e3(); /// e3: continued |
| 130 c = new C.e4(); /// e4: continued | 181 c = new C.e4(); /// e4: continued |
| 131 c = new C.e5(); /// e5: continued | 182 c = new C.e5(); /// e5: continued |
| 132 c = new C.e6(); /// e6: continued | 183 c = new C.e6(); /// e6: continued |
| 133 c = new C.e7(); /// e7: continued | 184 c = new C.e7(); /// e7: continued |
| 134 c = new C.e8(); /// e8: continued | 185 c = new C.e8(); /// e8: continued |
| 135 c = new C.e9(); /// e9: continued | 186 c = new C.e9(); /// e9: continued |
| (...skipping 14 matching lines...) Expand all Loading... |
| 150 a05e(); /// a05e: continued | 201 a05e(); /// a05e: continued |
| 151 a05f(); /// a05f: continued | 202 a05f(); /// a05f: continued |
| 152 a06a(); /// a06a: continued | 203 a06a(); /// a06a: continued |
| 153 a06b(); /// a06b: continued | 204 a06b(); /// a06b: continued |
| 154 a07a(); /// a07a: continued | 205 a07a(); /// a07a: continued |
| 155 a07b(); /// a07b: continued | 206 a07b(); /// a07b: continued |
| 156 a08a(); /// a08a: continued | 207 a08a(); /// a08a: continued |
| 157 a08b(); /// a08b: continued | 208 a08b(); /// a08b: continued |
| 158 a09a(); /// a09a: continued | 209 a09a(); /// a09a: continued |
| 159 a10a(); /// a10a: continued | 210 a10a(); /// a10a: continued |
| 211 a = sync; /// a11a: continued |
| 212 a = sync; /// a11b: continued |
| 213 a = async; /// a11c: continued |
| 214 a = async; /// a11d: continued |
| 215 a = sync; /// a12a: continued |
| 216 a = sync; /// a12b: continued |
| 217 a = async; /// a12c: continued |
| 218 a = async; /// a12d: continued |
| 219 a = sync; /// a13a: continued |
| 220 a = sync; /// a13b: continued |
| 221 a = async; /// a13c: continued |
| 222 a = async; /// a13d: continued |
| 223 a = sync; /// a14a: continued |
| 224 a = sync; /// a14b: continued |
| 225 a = async; /// a14c: continued |
| 226 a = async; /// a14d: continued |
| 227 sync(); /// a15a: continued |
| 228 sync(); /// a15b: continued |
| 229 async(); /// a15c: continued |
| 230 async(); /// a15d: continued |
| 160 | 231 |
| 161 c.b00a(); /// b00a: continued | 232 c.b00a(); /// b00a: continued |
| 162 c.b00b(); /// b00b: continued | 233 c.b00b(); /// b00b: continued |
| 163 c.b00c(); /// b00c: continued | 234 c.b00c(); /// b00c: continued |
| 164 c.b00d(); /// b00d: continued | 235 c.b00d(); /// b00d: continued |
| 165 c.b01a(); /// b01a: continued | 236 c.b01a(); /// b01a: continued |
| 166 c.b01b(); /// b01b: continued | 237 c.b01b(); /// b01b: continued |
| 167 c.b01c(); /// b01c: continued | 238 c.b01c(); /// b01c: continued |
| 168 c.b02a(); /// b02a: continued | 239 c.b02a(); /// b02a: continued |
| 169 c.b03a(); /// b03a: continued | 240 c.b03a(); /// b03a: continued |
| 170 c.b04a(); /// b04a: continued | 241 c.b04a(); /// b04a: continued |
| 171 c.b04b(); /// b04b: continued | 242 c.b04b(); /// b04b: continued |
| 172 c.b05a(); /// b05a: continued | 243 c.b05a(); /// b05a: continued |
| 173 c.b06a(); /// b06a: continued | 244 c.b06a(); /// b06a: continued |
| 174 c.b06b(); /// b06b: continued | 245 c.b06b(); /// b06b: continued |
| 175 c.b07a(); /// b07a: continued | 246 c.b07a(); /// b07a: continued |
| 176 c.b08a(); /// b08a: continued | 247 c.b08a(); /// b08a: continued |
| 177 c.b09a(); /// b09a: continued | 248 c.b09a(); /// b09a: continued |
| 178 c.b10a(); /// b10a: continued | 249 c.b10a(); /// b10a: continued |
| 250 a = c.sync; /// b11a: continued |
| 251 a = c.sync; /// b11b: continued |
| 252 a = c.async; /// b11c: continued |
| 253 a = c.async; /// b11d: continued |
| 254 a = c.sync; /// b12a: continued |
| 255 a = c.sync; /// b12b: continued |
| 256 a = c.async; /// b12c: continued |
| 257 a = c.async; /// b12d: continued |
| 258 a = c.sync; /// b13a: continued |
| 259 a = c.sync; /// b13b: continued |
| 260 a = c.async; /// b13c: continued |
| 261 a = c.async; /// b13d: continued |
| 262 a = c.sync; /// b14a: continued |
| 263 a = c.sync; /// b14b: continued |
| 264 a = c.async; /// b14c: continued |
| 265 a = c.async; /// b14d: continued |
| 266 c.sync(); /// b15a: continued |
| 267 c.sync(); /// b15b: continued |
| 268 c.async(); /// b15c: continued |
| 269 c.async(); /// b15d: continued |
| 179 | 270 |
| 180 method1(); | 271 method1(); |
| 181 method2(); | 272 method2(); |
| 182 } | 273 } |
| OLD | NEW |