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

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

Issue 926553005: Move the try-catch out of the async-function (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update unit test Created 5 years, 10 months 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
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 import "package:expect/expect.dart"; 5 import "package:expect/expect.dart";
6 import "package:compiler/src/js/js.dart"; 6 import "package:compiler/src/js/js.dart";
7 import "package:compiler/src/js/rewrite_async.dart"; 7 import "package:compiler/src/js/rewrite_async.dart";
8 8
9 import "backend_dart/dart_printer_test.dart" show PrintDiagnosticListener; 9 import "backend_dart/dart_printer_test.dart" show PrintDiagnosticListener;
10 10
(...skipping 23 matching lines...) Expand all
34 await foo(); 34 await foo();
35 }""", """ 35 }""", """
36 function(a) { 36 function(a) {
37 var __goto = 0, __completer = new Completer(), __handler = 1, __currentError, __self = this; 37 var __goto = 0, __completer = new Completer(), __handler = 1, __currentError, __self = this;
38 function __body(__errorCode, __result) { 38 function __body(__errorCode, __result) {
39 if (__errorCode == 1) { 39 if (__errorCode == 1) {
40 __currentError = __result; 40 __currentError = __result;
41 __goto = __handler; 41 __goto = __handler;
42 } 42 }
43 while (true) 43 while (true)
44 try { 44 switch (__goto) {
45 switch (__goto) { 45 case 0:
46 case 0: 46 // Function start
47 // Function start 47 print(__self.x);
48 print(__self.x); 48 __goto = 2;
49 __goto = 2; 49 return thenHelper(foo(), __body, __completer);
50 return thenHelper(foo(), __body, __completer); 50 case 2:
51 case 2: 51 // returning from await.
52 // returning from await. 52 // implicit return
53 // implicit return 53 return thenHelper(null, 0, __completer, null);
54 return thenHelper(null, 0, __completer, null); 54 case 1:
55 case 1: 55 // rethrow
56 // rethrow 56 return thenHelper(__currentError, 1, __completer);
57 return thenHelper(__currentError, 1, __completer);
58 }
59 } catch (__error) {
60 __currentError = __error;
61 __goto = __handler;
62 } 57 }
63
64 } 58 }
65 return thenHelper(null, __body, __completer, null); 59 return thenHelper(null, __body, __completer, null);
66 }"""); 60 }""");
67 61
68 testTransform(""" 62 testTransform("""
69 function(b) async { 63 function(b) async {
70 try { 64 try {
71 __outer: while (true) { // Overlapping label name. 65 __outer: while (true) { // Overlapping label name.
72 try { 66 try {
73 inner: while (true) { 67 inner: while (true) {
74 break __outer; // Break from untranslated loop to translated target. 68 break __outer; // Break from untranslated loop to translated target.
75 break; // break to untranslated target. 69 break; // break to untranslated target.
70 }
71 while (true) {
72 return; // Return via finallies.
73 }
74 var __helper = await foo(); // Overlapping variable name.
75 } finally {
76 foo();
77 continue; // Continue from finally with pending finally.
78 return 2; // Return from finally with pending finally.
76 } 79 }
77 while (true) {
78 return; // Return via finallies.
79 }
80 var __helper = await foo(); // Overlapping variable name.
81 } finally {
82 foo();
83 continue; // Continue from finally with pending finally.
84 return 2; // Return from finally with pending finally.
85 } 80 }
81 } finally {
82 return 3; // Return from finally with no pending finally.
86 } 83 }
87 } finally { 84 return 4;
88 return 3; // Return from finally with no pending finally. 85 }""", """
89 }
90 return 4;
91 }""", """
92 function(b) { 86 function(b) {
93 var __goto = 0, __completer = new Completer(), __handler = 2, __currentError, __next, __returnValue, __helper; 87 var __goto = 0, __completer = new Completer(), __handler = 2, __currentError, __next, __returnValue, __helper;
94 function __body(__errorCode, __result) { 88 function __body(__errorCode, __result) {
95 if (__errorCode == 1) { 89 if (__errorCode == 1) {
96 __currentError = __result; 90 __currentError = __result;
97 __goto = __handler; 91 __goto = __handler;
98 } 92 }
99 while (true) 93 while (true)
100 try { 94 __outer1:
101 __outer1: 95 switch (__goto) {
102 switch (__goto) { 96 case 0:
103 case 0: 97 // Function start
104 // Function start 98 __handler = 3;
105 __handler = 3; 99 case 7:
106 case 7: 100 // continue __outer
107 // continue __outer 101 case 8:
108 case 8: 102 // while condition
109 // while condition 103 __handler = 10;
110 __handler = 10; 104 inner: {
111 inner: {
112 while (true) {
113 __next = [6];
114 // goto finally
115 __goto = 11;
116 break __outer1;
117 break;
118 }
119 }
120 while (true) { 105 while (true) {
121 __next = [1, 4]; 106 __next = [6];
122 // goto finally 107 // goto finally
123 __goto = 11; 108 __goto = 11;
124 break __outer1; 109 break __outer1;
110 break;
125 } 111 }
126 __goto = 13; 112 }
127 return thenHelper(foo(), __body, __completer); 113 while (true) {
128 case 13: 114 __next = [1, 4];
129 // returning from await.
130 __helper = __result;
131 __next = [12];
132 // goto finally 115 // goto finally
133 __goto = 11; 116 __goto = 11;
134 break; 117 break __outer1;
135 case 10: 118 }
136 // uncaught 119 __goto = 13;
137 __next = [3]; 120 return thenHelper(foo(), __body, __completer);
138 case 11: 121 case 13:
139 // finally 122 // returning from await.
140 __handler = 3; 123 __helper = __result;
141 foo(); 124 __next = [12];
142 // goto while condition 125 // goto finally
143 __goto = 8; 126 __goto = 11;
144 break; 127 break;
145 __returnValue = 2; 128 case 10:
146 __next = [1]; 129 // uncaught
147 // goto finally 130 __next = [3];
148 __goto = 4; 131 case 11:
149 break; 132 // finally
150 // goto the next finally handler 133 __handler = 3;
151 __goto = __next.pop(); 134 foo();
152 break; 135 // goto while condition
153 case 12: 136 __goto = 8;
154 // after finally 137 break;
155 // goto while condition 138 __returnValue = 2;
156 __goto = 8; 139 __next = [1];
157 break; 140 // goto finally
158 case 9: 141 __goto = 4;
159 // after while 142 break;
160 case 6: 143 // goto the next finally handler
161 // break __outer 144 __goto = __next.pop();
162 __next = [5]; 145 break;
163 // goto finally 146 case 12:
164 __goto = 4; 147 // after finally
165 break; 148 // goto while condition
166 case 3: 149 __goto = 8;
167 // uncaught 150 break;
168 __next = [2]; 151 case 9:
169 case 4: 152 // after while
170 // finally 153 case 6:
171 __handler = 2; 154 // break __outer
172 __returnValue = 3; 155 __next = [5];
173 // goto return 156 // goto finally
174 __goto = 1; 157 __goto = 4;
175 break; 158 break;
176 // goto the next finally handler 159 case 3:
177 __goto = __next.pop(); 160 // uncaught
178 break; 161 __next = [2];
179 case 5: 162 case 4:
180 // after finally 163 // finally
181 __returnValue = 4; 164 __handler = 2;
182 // goto return 165 __returnValue = 3;
183 __goto = 1; 166 // goto return
184 break; 167 __goto = 1;
185 case 1: 168 break;
186 // return 169 // goto the next finally handler
187 return thenHelper(__returnValue, 0, __completer, null); 170 __goto = __next.pop();
188 case 2: 171 break;
189 // rethrow 172 case 5:
190 return thenHelper(__currentError, 1, __completer); 173 // after finally
191 } 174 __returnValue = 4;
192 } catch (__error) { 175 // goto return
193 __currentError = __error; 176 __goto = 1;
194 __goto = __handler; 177 break;
195 } 178 case 1:
196 179 // return
180 return thenHelper(__returnValue, 0, __completer, null);
181 case 2:
182 // rethrow
183 return thenHelper(__currentError, 1, __completer);
184 }
197 } 185 }
198 return thenHelper(null, __body, __completer, null); 186 return thenHelper(null, __body, __completer, null);
199 }"""); 187 }""");
200 188
201 testTransform(""" 189 testTransform("""
202 function(c) async { 190 function(c) async {
203 var a, b, c, d, e, f; 191 var a, b, c, d, e, f;
204 a = b++; // post- and preincrements. 192 a = b++; // post- and preincrements.
205 b = --b; 193 b = --b;
206 c = (await foo()).a++; 194 c = (await foo()).a++;
207 d = ++(await foo()).a; 195 d = ++(await foo()).a;
208 e = foo1()[await foo2()]--; 196 e = foo1()[await foo2()]--;
209 f = --foo1()[await foo2()]; 197 f = --foo1()[await foo2()];
210 }""", """ 198 }""", """
211 function(c) { 199 function(c) {
212 var __goto = 0, __completer = new Completer(), __handler = 1, __currentError, a, b, c, d, e, f, __temp1; 200 var __goto = 0, __completer = new Completer(), __handler = 1, __currentError, a, b, c, d, e, f, __temp1;
213 function __body(__errorCode, __result) { 201 function __body(__errorCode, __result) {
214 if (__errorCode == 1) { 202 if (__errorCode == 1) {
215 __currentError = __result; 203 __currentError = __result;
216 __goto = __handler; 204 __goto = __handler;
217 } 205 }
218 while (true) 206 while (true)
219 try { 207 switch (__goto) {
220 switch (__goto) { 208 case 0:
221 case 0: 209 // Function start
222 // Function start 210 a = b++;
223 a = b++; 211 b = --b;
224 b = --b; 212 __goto = 2;
225 __goto = 2; 213 return thenHelper(foo(), __body, __completer);
226 return thenHelper(foo(), __body, __completer); 214 case 2:
227 case 2: 215 // returning from await.
228 // returning from await. 216 c = __result.a++;
229 c = __result.a++; 217 __goto = 3;
230 __goto = 3; 218 return thenHelper(foo(), __body, __completer);
231 return thenHelper(foo(), __body, __completer); 219 case 3:
232 case 3: 220 // returning from await.
233 // returning from await. 221 d = ++__result.a;
234 d = ++__result.a; 222 __temp1 = foo1();
235 __temp1 = foo1(); 223 __goto = 4;
236 __goto = 4; 224 return thenHelper(foo2(), __body, __completer);
237 return thenHelper(foo2(), __body, __completer); 225 case 4:
238 case 4: 226 // returning from await.
239 // returning from await. 227 e = __temp1[__result]--;
240 e = __temp1[__result]--; 228 __temp1 = foo1();
241 __temp1 = foo1(); 229 __goto = 5;
242 __goto = 5; 230 return thenHelper(foo2(), __body, __completer);
243 return thenHelper(foo2(), __body, __completer); 231 case 5:
244 case 5: 232 // returning from await.
245 // returning from await. 233 f = --__temp1[__result];
246 f = --__temp1[__result]; 234 // implicit return
247 // implicit return 235 return thenHelper(null, 0, __completer, null);
248 return thenHelper(null, 0, __completer, null); 236 case 1:
249 case 1: 237 // rethrow
250 // rethrow 238 return thenHelper(__currentError, 1, __completer);
251 return thenHelper(__currentError, 1, __completer);
252 }
253 } catch (__error) {
254 __currentError = __error;
255 __goto = __handler;
256 } 239 }
257
258 } 240 }
259 return thenHelper(null, __body, __completer, null); 241 return thenHelper(null, __body, __completer, null);
260 }"""); 242 }""");
261 243
262 testTransform(""" 244 testTransform("""
263 function(d2) async { 245 function(d2) async {
264 var a, b, c, d, e, f, g, h; // empty initializer 246 var a, b, c, d, e, f, g, h; // empty initializer
265 a = foo1() || await foo2(); // short circuiting operators 247 a = foo1() || await foo2(); // short circuiting operators
266 b = await foo1() || foo2(); 248 b = await foo1() || foo2();
267 c = await foo1() || foo3(await foo2()); 249 c = await foo1() || foo3(await foo2());
268 d = foo1() || foo2(); 250 d = foo1() || foo2();
269 e = foo1() && await foo2(); 251 e = foo1() && await foo2();
270 f = await foo1() && foo2(); 252 f = await foo1() && foo2();
271 g = await foo1() && await foo2(); 253 g = await foo1() && await foo2();
272 h = foo1() && foo2(); 254 h = foo1() && foo2();
273 }""", """ 255 }""", """
274 function(d2) { 256 function(d2) {
275 var __goto = 0, __completer = new Completer(), __handler = 1, __currentError, a, b, c, d, e, f, g, h, __temp1; 257 var __goto = 0, __completer = new Completer(), __handler = 1, __currentError, a, b, c, d, e, f, g, h, __temp1;
276 function __body(__errorCode, __result) { 258 function __body(__errorCode, __result) {
277 if (__errorCode == 1) { 259 if (__errorCode == 1) {
278 __currentError = __result; 260 __currentError = __result;
279 __goto = __handler; 261 __goto = __handler;
280 } 262 }
281 while (true) 263 while (true)
282 try { 264 switch (__goto) {
283 switch (__goto) { 265 case 0:
284 case 0: 266 // Function start
285 // Function start 267 __temp1 = foo1();
286 __temp1 = foo1(); 268 if (__temp1) {
287 if (__temp1) { 269 // goto then
288 // goto then 270 __goto = 2;
289 __goto = 2;
290 break;
291 } else
292 __result = __temp1;
293 // goto join
294 __goto = 3;
295 break; 271 break;
296 case 2: 272 } else
297 // then 273 __result = __temp1;
298 __goto = 4; 274 // goto join
299 return thenHelper(foo2(), __body, __completer); 275 __goto = 3;
300 case 4: 276 break;
301 // returning from await. 277 case 2:
302 case 3: 278 // then
303 // join 279 __goto = 4;
304 a = __result; 280 return thenHelper(foo2(), __body, __completer);
305 __goto = 5; 281 case 4:
306 return thenHelper(foo1(), __body, __completer); 282 // returning from await.
307 case 5: 283 case 3:
308 // returning from await. 284 // join
309 b = __result || foo2(); 285 a = __result;
310 __goto = 8; 286 __goto = 5;
311 return thenHelper(foo1(), __body, __completer); 287 return thenHelper(foo1(), __body, __completer);
312 case 8: 288 case 5:
313 // returning from await. 289 // returning from await.
314 __temp1 = __result; 290 b = __result || foo2();
315 if (__temp1) { 291 __goto = 8;
316 // goto then 292 return thenHelper(foo1(), __body, __completer);
317 __goto = 6; 293 case 8:
318 break; 294 // returning from await.
319 } else 295 __temp1 = __result;
320 __result = __temp1; 296 if (__temp1) {
321 // goto join 297 // goto then
322 __goto = 7; 298 __goto = 6;
323 break; 299 break;
324 case 6: 300 } else
325 // then 301 __result = __temp1;
326 __temp1 = foo3; 302 // goto join
327 __goto = 9; 303 __goto = 7;
328 return thenHelper(foo2(), __body, __completer); 304 break;
329 case 9: 305 case 6:
330 // returning from await. 306 // then
331 __result = __temp1(__result); 307 __temp1 = foo3;
332 case 7: 308 __goto = 9;
333 // join 309 return thenHelper(foo2(), __body, __completer);
334 c = __result; 310 case 9:
335 d = foo1() || foo2(); 311 // returning from await.
336 __temp1 = foo1(); 312 __result = __temp1(__result);
337 if (__temp1) 313 case 7:
338 __result = __temp1; 314 // join
339 else { 315 c = __result;
340 // goto then 316 d = foo1() || foo2();
341 __goto = 10; 317 __temp1 = foo1();
342 break; 318 if (__temp1)
343 } 319 __result = __temp1;
344 // goto join 320 else {
345 __goto = 11; 321 // goto then
322 __goto = 10;
346 break; 323 break;
347 case 10: 324 }
348 // then 325 // goto join
349 __goto = 12; 326 __goto = 11;
350 return thenHelper(foo2(), __body, __completer); 327 break;
351 case 12: 328 case 10:
352 // returning from await. 329 // then
353 case 11: 330 __goto = 12;
354 // join 331 return thenHelper(foo2(), __body, __completer);
355 e = __result; 332 case 12:
356 __goto = 13; 333 // returning from await.
357 return thenHelper(foo1(), __body, __completer); 334 case 11:
358 case 13: 335 // join
359 // returning from await. 336 e = __result;
360 f = __result && foo2(); 337 __goto = 13;
361 __goto = 16; 338 return thenHelper(foo1(), __body, __completer);
362 return thenHelper(foo1(), __body, __completer); 339 case 13:
363 case 16: 340 // returning from await.
364 // returning from await. 341 f = __result && foo2();
365 __temp1 = __result; 342 __goto = 16;
366 if (__temp1) 343 return thenHelper(foo1(), __body, __completer);
367 __result = __temp1; 344 case 16:
368 else { 345 // returning from await.
369 // goto then 346 __temp1 = __result;
370 __goto = 14; 347 if (__temp1)
371 break; 348 __result = __temp1;
372 } 349 else {
373 // goto join 350 // goto then
374 __goto = 15; 351 __goto = 14;
375 break; 352 break;
376 case 14: 353 }
377 // then 354 // goto join
378 __goto = 17; 355 __goto = 15;
379 return thenHelper(foo2(), __body, __completer); 356 break;
380 case 17: 357 case 14:
381 // returning from await. 358 // then
382 case 15: 359 __goto = 17;
383 // join 360 return thenHelper(foo2(), __body, __completer);
384 g = __result; 361 case 17:
385 h = foo1() && foo2(); 362 // returning from await.
386 // implicit return 363 case 15:
387 return thenHelper(null, 0, __completer, null); 364 // join
388 case 1: 365 g = __result;
389 // rethrow 366 h = foo1() && foo2();
390 return thenHelper(__currentError, 1, __completer); 367 // implicit return
391 } 368 return thenHelper(null, 0, __completer, null);
392 } catch (__error) { 369 case 1:
393 __currentError = __error; 370 // rethrow
394 __goto = __handler; 371 return thenHelper(__currentError, 1, __completer);
395 } 372 }
396
397 } 373 }
398 return thenHelper(null, __body, __completer, null); 374 return thenHelper(null, __body, __completer, null);
399 }"""); 375 }""");
400 376
401 testTransform(""" 377 testTransform("""
402 function(x, y) async { 378 function(x, y) async {
403 while (true) { 379 while (true) {
404 switch(y) { // Switch with no awaits in case key expressions 380 switch(y) { // Switch with no awaits in case key expressions
405 case 0: 381 case 0:
406 case 1: 382 case 1:
407 await foo(); 383 await foo();
408 continue; // Continue the loop, not the switch 384 continue; // Continue the loop, not the switch
409 case 1: // Duplicate case 385 case 1: // Duplicate case
410 await foo(); 386 await foo();
411 break; // Break the switch 387 break; // Break the switch
412 case 2: 388 case 2:
413 foo(); // No default 389 foo(); // No default
414 } 390 }
415 } 391 }
416 }""", """ 392 }""", """
417 function(x, y) { 393 function(x, y) {
418 var __goto = 0, __completer = new Completer(), __handler = 1, __currentError; 394 var __goto = 0, __completer = new Completer(), __handler = 1, __currentError;
419 function __body(__errorCode, __result) { 395 function __body(__errorCode, __result) {
420 if (__errorCode == 1) { 396 if (__errorCode == 1) {
421 __currentError = __result; 397 __currentError = __result;
422 __goto = __handler; 398 __goto = __handler;
423 } 399 }
424 while (true) 400 while (true)
425 try { 401 switch (__goto) {
426 switch (__goto) { 402 case 0:
427 case 0: 403 // Function start
428 // Function start 404 case 2:
429 case 2: 405 // while condition
430 // while condition 406 case 4:
431 case 4: 407 // switch
432 // switch 408 switch (y) {
433 switch (y) { 409 case 0:
434 case 0: 410 // goto case
435 // goto case 411 __goto = 6;
436 __goto = 6; 412 break;
437 break; 413 case 1:
438 case 1: 414 // goto case
439 // goto case 415 __goto = 7;
440 __goto = 7; 416 break;
441 break; 417 case 1:
442 case 1: 418 // goto case
443 // goto case 419 __goto = 8;
444 __goto = 8; 420 break;
445 break; 421 case 2:
446 case 2: 422 // goto case
447 // goto case 423 __goto = 9;
448 __goto = 9; 424 break;
449 break; 425 }
450 } 426 // goto after switch
451 // goto after switch 427 __goto = 5;
452 __goto = 5; 428 break;
453 break; 429 case 6:
454 case 6: 430 // case
455 // case 431 case 7:
456 case 7: 432 // case
457 // case 433 __goto = 10;
458 __goto = 10; 434 return thenHelper(foo(), __body, __completer);
459 return thenHelper(foo(), __body, __completer); 435 case 10:
460 case 10: 436 // returning from await.
461 // returning from await. 437 // goto while condition
462 // goto while condition 438 __goto = 2;
463 __goto = 2; 439 break;
464 break; 440 case 8:
465 case 8: 441 // case
466 // case 442 __goto = 11;
467 __goto = 11; 443 return thenHelper(foo(), __body, __completer);
468 return thenHelper(foo(), __body, __completer); 444 case 11:
469 case 11: 445 // returning from await.
470 // returning from await. 446 // goto after switch
471 // goto after switch 447 __goto = 5;
472 __goto = 5; 448 break;
473 break; 449 case 9:
474 case 9: 450 // case
475 // case 451 foo();
476 foo(); 452 case 5:
477 case 5: 453 // after switch
478 // after switch 454 // goto while condition
479 // goto while condition 455 __goto = 2;
480 __goto = 2; 456 break;
481 break; 457 case 3:
482 case 3: 458 // after while
483 // after while 459 // implicit return
484 // implicit return 460 return thenHelper(null, 0, __completer, null);
485 return thenHelper(null, 0, __completer, null); 461 case 1:
486 case 1: 462 // rethrow
487 // rethrow 463 return thenHelper(__currentError, 1, __completer);
488 return thenHelper(__currentError, 1, __completer);
489 }
490 } catch (__error) {
491 __currentError = __error;
492 __goto = __handler;
493 } 464 }
494
495 } 465 }
496 return thenHelper(null, __body, __completer, null); 466 return thenHelper(null, __body, __completer, null);
497 }"""); 467 }""");
498 468
499 testTransform(""" 469 testTransform("""
500 function(f) async { 470 function(f) async {
501 do { 471 do {
502 var a = await foo(); 472 var a = await foo();
503 if (a) // If with no awaits in body 473 if (a) // If with no awaits in body
504 break; 474 break;
505 else 475 else
506 continue; 476 continue;
507 } while (await foo()); 477 } while (await foo());
508 } 478 }
509 """, """ 479 """, """
510 function(f) { 480 function(f) {
511 var __goto = 0, __completer = new Completer(), __handler = 1, __currentError, a; 481 var __goto = 0, __completer = new Completer(), __handler = 1, __currentError, a;
512 function __body(__errorCode, __result) { 482 function __body(__errorCode, __result) {
513 if (__errorCode == 1) { 483 if (__errorCode == 1) {
514 __currentError = __result; 484 __currentError = __result;
515 __goto = __handler; 485 __goto = __handler;
516 } 486 }
517 while (true) 487 while (true)
518 try { 488 switch (__goto) {
519 switch (__goto) { 489 case 0:
520 case 0: 490 // Function start
521 // Function start 491 case 2:
522 case 2: 492 // do body
523 // do body 493 __goto = 5;
524 __goto = 5; 494 return thenHelper(foo(), __body, __completer);
525 return thenHelper(foo(), __body, __completer); 495 case 5:
526 case 5: 496 // returning from await.
527 // returning from await. 497 a = __result;
528 a = __result; 498 if (a) {
529 if (a) { 499 // goto after do
530 // goto after do 500 __goto = 4;
531 __goto = 4; 501 break;
532 break; 502 } else {
533 } else { 503 // goto do condition
534 // goto do condition 504 __goto = 3;
535 __goto = 3; 505 break;
536 break; 506 }
537 } 507 case 3:
538 case 3: 508 // do condition
539 // do condition 509 __goto = 6;
540 __goto = 6; 510 return thenHelper(foo(), __body, __completer);
541 return thenHelper(foo(), __body, __completer); 511 case 6:
542 case 6: 512 // returning from await.
543 // returning from await. 513 if (__result) {
544 if (__result) { 514 // goto do body
545 // goto do body 515 __goto = 2;
546 __goto = 2; 516 break;
547 break; 517 }
548 } 518 case 4:
549 case 4: 519 // after do
550 // after do 520 // implicit return
551 // implicit return 521 return thenHelper(null, 0, __completer, null);
552 return thenHelper(null, 0, __completer, null); 522 case 1:
553 case 1: 523 // rethrow
554 // rethrow 524 return thenHelper(__currentError, 1, __completer);
555 return thenHelper(__currentError, 1, __completer);
556 }
557 } catch (__error) {
558 __currentError = __error;
559 __goto = __handler;
560 } 525 }
561
562 } 526 }
563 return thenHelper(null, __body, __completer, null); 527 return thenHelper(null, __body, __completer, null);
564 }"""); 528 }""");
565 529
566 testTransform(""" 530 testTransform("""
567 function(g) async { 531 function(g) async {
568 for (var i = 0; i < await foo1(); i += await foo2()) { 532 for (var i = 0; i < await foo1(); i += await foo2()) {
569 if (foo(i)) 533 if (foo(i))
570 continue; 534 continue;
571 else 535 else
572 break; 536 break;
573 if (!foo(i)) { // If with no else and await in body. 537 if (!foo(i)) { // If with no else and await in body.
574 await foo(); 538 await foo();
575 return; 539 return;
576 } 540 }
577 print(await(foo(i))); 541 print(await(foo(i)));
578 } 542 }
579 } 543 }
580 """, """ 544 """, """
581 function(g) { 545 function(g) {
582 var __goto = 0, __completer = new Completer(), __handler = 2, __currentError, __returnValue, i, __temp1; 546 var __goto = 0, __completer = new Completer(), __handler = 2, __currentError, __returnValue, i, __temp1;
583 function __body(__errorCode, __result) { 547 function __body(__errorCode, __result) {
584 if (__errorCode == 1) { 548 if (__errorCode == 1) {
585 __currentError = __result; 549 __currentError = __result;
586 __goto = __handler; 550 __goto = __handler;
587 } 551 }
588 while (true) 552 while (true)
589 try { 553 switch (__goto) {
590 switch (__goto) { 554 case 0:
591 case 0: 555 // Function start
592 // Function start 556 i = 0;
593 i = 0; 557 case 3:
594 case 3: 558 // for condition
595 // for condition 559 __temp1 = i;
596 __temp1 = i; 560 __goto = 6;
597 __goto = 6; 561 return thenHelper(foo1(), __body, __completer);
598 return thenHelper(foo1(), __body, __completer); 562 case 6:
599 case 6: 563 // returning from await.
600 // returning from await. 564 if (!(__temp1 < __result)) {
601 if (!(__temp1 < __result)) { 565 // goto after for
602 // goto after for 566 __goto = 5;
603 __goto = 5;
604 break;
605 }
606 if (foo(i)) {
607 // goto for update
608 __goto = 4;
609 break;
610 } else {
611 // goto after for
612 __goto = 5;
613 break;
614 }
615 __goto = !foo(i) ? 7 : 8;
616 break; 567 break;
617 case 7: 568 }
618 // then 569 if (foo(i)) {
619 __goto = 9; 570 // goto for update
620 return thenHelper(foo(), __body, __completer); 571 __goto = 4;
621 case 9:
622 // returning from await.
623 // goto return
624 __goto = 1;
625 break; 572 break;
626 case 8: 573 } else {
627 // join 574 // goto after for
628 __temp1 = print; 575 __goto = 5;
629 __goto = 10;
630 return thenHelper(foo(i), __body, __completer);
631 case 10:
632 // returning from await.
633 __temp1(__result);
634 case 4:
635 // for update
636 __goto = 11;
637 return thenHelper(foo2(), __body, __completer);
638 case 11:
639 // returning from await.
640 i = __result;
641 // goto for condition
642 __goto = 3;
643 break; 576 break;
644 case 5: 577 }
645 // after for 578 __goto = !foo(i) ? 7 : 8;
646 case 1: 579 break;
647 // return 580 case 7:
648 return thenHelper(__returnValue, 0, __completer, null); 581 // then
649 case 2: 582 __goto = 9;
650 // rethrow 583 return thenHelper(foo(), __body, __completer);
651 return thenHelper(__currentError, 1, __completer); 584 case 9:
652 } 585 // returning from await.
653 } catch (__error) { 586 // goto return
654 __currentError = __error; 587 __goto = 1;
655 __goto = __handler; 588 break;
589 case 8:
590 // join
591 __temp1 = print;
592 __goto = 10;
593 return thenHelper(foo(i), __body, __completer);
594 case 10:
595 // returning from await.
596 __temp1(__result);
597 case 4:
598 // for update
599 __goto = 11;
600 return thenHelper(foo2(), __body, __completer);
601 case 11:
602 // returning from await.
603 i = __result;
604 // goto for condition
605 __goto = 3;
606 break;
607 case 5:
608 // after for
609 case 1:
610 // return
611 return thenHelper(__returnValue, 0, __completer, null);
612 case 2:
613 // rethrow
614 return thenHelper(__currentError, 1, __completer);
656 } 615 }
657
658 } 616 }
659 return thenHelper(null, __body, __completer, null); 617 return thenHelper(null, __body, __completer, null);
660 }"""); 618 }""");
661 619
662 testTransform(""" 620 testTransform("""
663 function(a, h) async { 621 function(a, h) async {
664 var x = {"a": foo1(), "b": await foo2(), "c": foo3()}; 622 var x = {"a": foo1(), "b": await foo2(), "c": foo3()};
665 x["a"] = 2; // Different assignments 623 x["a"] = 2; // Different assignments
666 (await foo()).a = 3; 624 (await foo()).a = 3;
667 x[await foo()] = 4; 625 x[await foo()] = 4;
668 x[(await foo1()).a = await foo2()] = 5; 626 x[(await foo1()).a = await foo2()] = 5;
669 (await foo1())[await foo2()] = await foo3(6); 627 (await foo1())[await foo2()] = await foo3(6);
670 } 628 }
671 """, """ 629 """, """
672 function(a, h) { 630 function(a, h) {
673 var __goto = 0, __completer = new Completer(), __handler = 1, __currentError, x, __temp1, __temp2; 631 var __goto = 0, __completer = new Completer(), __handler = 1, __currentError, x, __temp1, __temp2;
674 function __body(__errorCode, __result) { 632 function __body(__errorCode, __result) {
675 if (__errorCode == 1) { 633 if (__errorCode == 1) {
676 __currentError = __result; 634 __currentError = __result;
677 __goto = __handler; 635 __goto = __handler;
678 } 636 }
679 while (true) 637 while (true)
680 try { 638 switch (__goto) {
681 switch (__goto) { 639 case 0:
682 case 0: 640 // Function start
683 // Function start 641 __temp1 = foo1();
684 __temp1 = foo1(); 642 __goto = 2;
685 __goto = 2; 643 return thenHelper(foo2(), __body, __completer);
686 return thenHelper(foo2(), __body, __completer); 644 case 2:
687 case 2: 645 // returning from await.
688 // returning from await. 646 x = {a: __temp1, b: __result, c: foo3()};
689 x = {a: __temp1, b: __result, c: foo3()}; 647 x.a = 2;
690 x.a = 2; 648 __goto = 3;
691 __goto = 3; 649 return thenHelper(foo(), __body, __completer);
692 return thenHelper(foo(), __body, __completer); 650 case 3:
693 case 3: 651 // returning from await.
694 // returning from await. 652 __result.a = 3;
695 __result.a = 3; 653 __temp1 = x;
696 __temp1 = x; 654 __goto = 4;
697 __goto = 4; 655 return thenHelper(foo(), __body, __completer);
698 return thenHelper(foo(), __body, __completer); 656 case 4:
699 case 4: 657 // returning from await.
700 // returning from await. 658 __temp1[__result] = 4;
701 __temp1[__result] = 4; 659 __temp1 = x;
702 __temp1 = x; 660 __goto = 5;
703 __goto = 5; 661 return thenHelper(foo1(), __body, __completer);
704 return thenHelper(foo1(), __body, __completer); 662 case 5:
705 case 5: 663 // returning from await.
706 // returning from await. 664 __temp2 = __result;
707 __temp2 = __result; 665 __goto = 6;
708 __goto = 6; 666 return thenHelper(foo2(), __body, __completer);
709 return thenHelper(foo2(), __body, __completer); 667 case 6:
710 case 6: 668 // returning from await.
711 // returning from await. 669 __temp1[__temp2.a = __result] = 5;
712 __temp1[__temp2.a = __result] = 5; 670 __goto = 7;
713 __goto = 7; 671 return thenHelper(foo1(), __body, __completer);
714 return thenHelper(foo1(), __body, __completer); 672 case 7:
715 case 7: 673 // returning from await.
716 // returning from await. 674 __temp1 = __result;
717 __temp1 = __result; 675 __goto = 8;
718 __goto = 8; 676 return thenHelper(foo2(), __body, __completer);
719 return thenHelper(foo2(), __body, __completer); 677 case 8:
720 case 8: 678 // returning from await.
721 // returning from await. 679 __temp2 = __result;
722 __temp2 = __result; 680 __goto = 9;
723 __goto = 9; 681 return thenHelper(foo3(6), __body, __completer);
724 return thenHelper(foo3(6), __body, __completer); 682 case 9:
725 case 9: 683 // returning from await.
726 // returning from await. 684 __temp1[__temp2] = __result;
727 __temp1[__temp2] = __result; 685 // implicit return
728 // implicit return 686 return thenHelper(null, 0, __completer, null);
729 return thenHelper(null, 0, __completer, null); 687 case 1:
730 case 1: 688 // rethrow
731 // rethrow 689 return thenHelper(__currentError, 1, __completer);
732 return thenHelper(__currentError, 1, __completer);
733 }
734 } catch (__error) {
735 __currentError = __error;
736 __goto = __handler;
737 } 690 }
738
739 } 691 }
740 return thenHelper(null, __body, __completer, null); 692 return thenHelper(null, __body, __completer, null);
741 }"""); 693 }""");
742 694
743 testTransform(""" 695 testTransform("""
744 function(c, i) async { 696 function(c, i) async {
745 try { 697 try {
746 var x = c ? await foo() : foo(); // conditional 698 var x = c ? await foo() : foo(); // conditional
747 var y = {}; 699 var y = {};
748 } catch (error) { 700 } catch (error) {
749 try { 701 try {
750 x = c ? await fooError(error) : fooError(error); 702 x = c ? await fooError(error) : fooError(error);
751 } catch (error) { // nested error handler with overlapping name 703 } catch (error) { // nested error handler with overlapping name
752 y.x = foo(error); 704 y.x = foo(error);
753 } finally { 705 } finally {
754 foo(x); 706 foo(x);
755 } 707 }
756 } 708 }
757 } 709 }
758 """, """ 710 """, """
759 function(c, i) { 711 function(c, i) {
760 var __goto = 0, __completer = new Completer(), __handler = 1, __currentError, x, y, __error1, __error2; 712 var __goto = 0, __completer = new Completer(), __handler = 1, __currentError, x, y, __error1, __error2;
761 function __body(__errorCode, __result) { 713 function __body(__errorCode, __result) {
762 if (__errorCode == 1) { 714 if (__errorCode == 1) {
763 __currentError = __result; 715 __currentError = __result;
764 __goto = __handler; 716 __goto = __handler;
765 } 717 }
766 while (true) 718 while (true)
767 try { 719 switch (__goto) {
768 switch (__goto) { 720 case 0:
769 case 0: 721 // Function start
770 // Function start 722 __handler = 3;
771 __handler = 3; 723 __goto = c ? 6 : 8;
772 __goto = c ? 6 : 8; 724 break;
773 break; 725 case 6:
774 case 6: 726 // then
775 // then 727 __goto = 9;
776 __goto = 9; 728 return thenHelper(foo(), __body, __completer);
777 return thenHelper(foo(), __body, __completer); 729 case 9:
778 case 9: 730 // returning from await.
779 // returning from await. 731 // goto join
780 // goto join 732 __goto = 7;
781 __goto = 7; 733 break;
782 break; 734 case 8:
783 case 8: 735 // else
784 // else 736 __result = foo();
785 __result = foo(); 737 case 7:
786 case 7: 738 // join
787 // join 739 x = __result;
788 x = __result; 740 y = {};
789 y = {}; 741 __handler = 1;
790 __handler = 1; 742 // goto after finally
791 // goto after finally 743 __goto = 5;
792 __goto = 5; 744 break;
793 break; 745 case 3:
794 case 3: 746 // catch
795 // catch 747 __handler = 2;
796 __handler = 2; 748 __error1 = __currentError;
797 __error1 = __currentError; 749 __handler = 11;
798 __handler = 11; 750 __goto = c ? 14 : 16;
799 __goto = c ? 14 : 16; 751 break;
800 break; 752 case 14:
801 case 14: 753 // then
802 // then 754 __goto = 17;
803 __goto = 17; 755 return thenHelper(fooError(__error1), __body, __completer);
804 return thenHelper(fooError(__error1), __body, __completer); 756 case 17:
805 case 17: 757 // returning from await.
806 // returning from await. 758 // goto join
807 // goto join 759 __goto = 15;
808 __goto = 15; 760 break;
809 break; 761 case 16:
810 case 16: 762 // else
811 // else 763 __result = fooError(__error1);
812 __result = fooError(__error1); 764 case 15:
813 case 15: 765 // join
814 // join 766 x = __result;
815 x = __result; 767 __next = [13];
816 __next = [13]; 768 // goto finally
817 // goto finally 769 __goto = 12;
818 __goto = 12; 770 break;
819 break; 771 case 11:
820 case 11: 772 // catch
821 // catch 773 __handler = 10;
822 __handler = 10; 774 __error2 = __currentError;
823 __error2 = __currentError; 775 y.x = foo(__error2);
824 y.x = foo(__error2); 776 __next = [13];
825 __next = [13]; 777 // goto finally
826 // goto finally 778 __goto = 12;
827 __goto = 12; 779 break;
828 break; 780 case 10:
829 case 10: 781 // uncaught
830 // uncaught 782 __next = [2];
831 __next = [2]; 783 case 12:
832 case 12: 784 // finally
833 // finally 785 __handler = 2;
834 __handler = 2; 786 foo(x);
835 foo(x); 787 // goto the next finally handler
836 // goto the next finally handler 788 __goto = __next.pop();
837 __goto = __next.pop(); 789 break;
838 break; 790 case 13:
839 case 13: 791 // after finally
840 // after finally 792 // goto after finally
841 // goto after finally 793 __goto = 5;
842 __goto = 5; 794 break;
843 break; 795 case 2:
844 case 2: 796 // uncaught
845 // uncaught 797 // goto rethrow
846 // goto rethrow 798 __goto = 1;
847 __goto = 1; 799 break;
848 break; 800 case 5:
849 case 5: 801 // after finally
850 // after finally 802 // implicit return
851 // implicit return 803 return thenHelper(null, 0, __completer, null);
852 return thenHelper(null, 0, __completer, null); 804 case 1:
853 case 1: 805 // rethrow
854 // rethrow 806 return thenHelper(__currentError, 1, __completer);
855 return thenHelper(__currentError, 1, __completer);
856 }
857 } catch (__error) {
858 __currentError = __error;
859 __goto = __handler;
860 } 807 }
861
862 } 808 }
863 return thenHelper(null, __body, __completer, null); 809 return thenHelper(null, __body, __completer, null);
864 }"""); 810 }""");
865 811
866 testTransform(""" 812 testTransform("""
867 function(x, y, j) async { 813 function(x, y, j) async {
868 print(await(foo(x))); // calls 814 print(await(foo(x))); // calls
869 (await print)(foo(x)); 815 (await print)(foo(x));
870 print(foo(await x)); 816 print(foo(await x));
871 await (print(foo(await x))); 817 await (print(foo(await x)));
872 print(foo(x, await y, z)); 818 print(foo(x, await y, z));
873 } 819 }
874 """, """ 820 """, """
875 function(x, y, j) { 821 function(x, y, j) {
876 var __goto = 0, __completer = new Completer(), __handler = 1, __currentError, __temp1, __temp2, __temp3; 822 var __goto = 0, __completer = new Completer(), __handler = 1, __currentError, __temp1, __temp2, __temp3;
877 function __body(__errorCode, __result) { 823 function __body(__errorCode, __result) {
878 if (__errorCode == 1) { 824 if (__errorCode == 1) {
879 __currentError = __result; 825 __currentError = __result;
880 __goto = __handler; 826 __goto = __handler;
881 } 827 }
882 while (true) 828 while (true)
883 try { 829 switch (__goto) {
884 switch (__goto) { 830 case 0:
885 case 0: 831 // Function start
886 // Function start 832 __temp1 = print;
887 __temp1 = print; 833 __goto = 2;
888 __goto = 2; 834 return thenHelper(foo(x), __body, __completer);
889 return thenHelper(foo(x), __body, __completer); 835 case 2:
890 case 2: 836 // returning from await.
891 // returning from await. 837 __temp1(__result);
892 __temp1(__result); 838 __goto = 3;
893 __goto = 3; 839 return thenHelper(print, __body, __completer);
894 return thenHelper(print, __body, __completer); 840 case 3:
895 case 3: 841 // returning from await.
896 // returning from await. 842 __result(foo(x));
897 __result(foo(x)); 843 __temp1 = print;
898 __temp1 = print; 844 __temp2 = foo;
899 __temp2 = foo; 845 __goto = 4;
900 __goto = 4; 846 return thenHelper(x, __body, __completer);
901 return thenHelper(x, __body, __completer); 847 case 4:
902 case 4: 848 // returning from await.
903 // returning from await. 849 __temp1(__temp2(__result));
904 __temp1(__temp2(__result)); 850 __temp1 = print;
905 __temp1 = print; 851 __temp2 = foo;
906 __temp2 = foo; 852 __goto = 6;
907 __goto = 6; 853 return thenHelper(x, __body, __completer);
908 return thenHelper(x, __body, __completer); 854 case 6:
909 case 6: 855 // returning from await.
910 // returning from await. 856 __goto = 5;
911 __goto = 5; 857 return thenHelper(__temp1(__temp2(__result)), __body, __completer);
912 return thenHelper(__temp1(__temp2(__result)), __body, __completer); 858 case 5:
913 case 5: 859 // returning from await.
914 // returning from await. 860 __temp1 = print;
915 __temp1 = print; 861 __temp2 = foo;
916 __temp2 = foo; 862 __temp3 = x;
917 __temp3 = x; 863 __goto = 7;
918 __goto = 7; 864 return thenHelper(y, __body, __completer);
919 return thenHelper(y, __body, __completer); 865 case 7:
920 case 7: 866 // returning from await.
921 // returning from await. 867 __temp1(__temp2(__temp3, __result, z));
922 __temp1(__temp2(__temp3, __result, z)); 868 // implicit return
923 // implicit return 869 return thenHelper(null, 0, __completer, null);
924 return thenHelper(null, 0, __completer, null); 870 case 1:
925 case 1: 871 // rethrow
926 // rethrow 872 return thenHelper(__currentError, 1, __completer);
927 return thenHelper(__currentError, 1, __completer);
928 }
929 } catch (__error) {
930 __currentError = __error;
931 __goto = __handler;
932 } 873 }
933
934 } 874 }
935 return thenHelper(null, __body, __completer, null); 875 return thenHelper(null, __body, __completer, null);
936 }"""); 876 }""");
937 877
938 testTransform(""" 878 testTransform("""
939 function(x, y, k) async { 879 function(x, y, k) async {
940 while (await(foo())) { 880 while (await(foo())) {
941 lab: { // labelled statement 881 lab: { // labelled statement
942 switch(y) { 882 switch(y) {
943 case 0: 883 case 0:
944 foo(); 884 foo();
945 case 0: // Duplicate case 885 case 0: // Duplicate case
946 print(await foo1(x)); 886 print(await foo1(x));
947 return y; 887 return y;
948 case await bar(): // await in case 888 case await bar(): // await in case
(...skipping 13 matching lines...) Expand all
962 } 902 }
963 }""", """ 903 }""", """
964 function(x, y, k) { 904 function(x, y, k) {
965 var __goto = 0, __completer = new Completer(), __handler = 2, __currentError, __returnValue, __temp1; 905 var __goto = 0, __completer = new Completer(), __handler = 2, __currentError, __returnValue, __temp1;
966 function __body(__errorCode, __result) { 906 function __body(__errorCode, __result) {
967 if (__errorCode == 1) { 907 if (__errorCode == 1) {
968 __currentError = __result; 908 __currentError = __result;
969 __goto = __handler; 909 __goto = __handler;
970 } 910 }
971 while (true) 911 while (true)
972 try { 912 switch (__goto) {
973 switch (__goto) { 913 case 0:
974 case 0: 914 // Function start
975 // Function start 915 case 3:
976 case 3: 916 // while condition
977 // while condition 917 __goto = 5;
978 __goto = 5; 918 return thenHelper(foo(), __body, __completer);
979 return thenHelper(foo(), __body, __completer); 919 case 5:
980 case 5: 920 // returning from await.
981 // returning from await. 921 if (!__result) {
982 if (!__result) { 922 // goto after while
983 // goto after while 923 __goto = 4;
984 __goto = 4;
985 break;
986 }
987 case 7:
988 // continue lab
989 case 8:
990 // switch
991 __temp1 = y;
992 if (__temp1 === 0) {
993 // goto case
994 __goto = 10;
995 break;
996 }
997 if (__temp1 === 0) {
998 // goto case
999 __goto = 11;
1000 break;
1001 }
1002 __goto = 13;
1003 return thenHelper(bar(), __body, __completer);
1004 case 13:
1005 // returning from await.
1006 if (__temp1 === __result) {
1007 // goto case
1008 __goto = 12;
1009 break;
1010 }
1011 if (__temp1 === x) {
1012 // goto case
1013 __goto = 14;
1014 break;
1015 }
1016 // goto default
1017 __goto = 15;
1018 break; 924 break;
1019 case 10: 925 }
1020 // case 926 case 7:
1021 foo(); 927 // continue lab
1022 case 11: 928 case 8:
1023 // case 929 // switch
1024 __temp1 = print; 930 __temp1 = y;
1025 __goto = 16; 931 if (__temp1 === 0) {
1026 return thenHelper(foo1(x), __body, __completer); 932 // goto case
1027 case 16: 933 __goto = 10;
1028 // returning from await.
1029 __temp1(__result);
1030 __returnValue = y;
1031 // goto return
1032 __goto = 1;
1033 break; 934 break;
1034 case 12: 935 }
1035 // case 936 if (__temp1 === 0) {
1036 __temp1 = print; 937 // goto case
1037 __goto = 17; 938 __goto = 11;
1038 return thenHelper(foobar(x), __body, __completer);
1039 case 17:
1040 // returning from await.
1041 __temp1(__result);
1042 __returnValue = y;
1043 // goto return
1044 __goto = 1;
1045 break; 939 break;
1046 case 14: 940 }
1047 // case 941 __goto = 13;
1048 if (a) { 942 return thenHelper(bar(), __body, __completer);
1049 throw new Error(); 943 case 13:
1050 } else { 944 // returning from await.
1051 // goto while condition 945 if (__temp1 === __result) {
1052 __goto = 3; 946 // goto case
1053 break; 947 __goto = 12;
1054 }
1055 case 15:
1056 // default
1057 // goto break lab
1058 __goto = 6;
1059 break; 948 break;
1060 case 9: 949 }
1061 // after switch 950 if (__temp1 === x) {
1062 foo(); 951 // goto case
1063 case 6: 952 __goto = 14;
1064 // break lab 953 break;
954 }
955 // goto default
956 __goto = 15;
957 break;
958 case 10:
959 // case
960 foo();
961 case 11:
962 // case
963 __temp1 = print;
964 __goto = 16;
965 return thenHelper(foo1(x), __body, __completer);
966 case 16:
967 // returning from await.
968 __temp1(__result);
969 __returnValue = y;
970 // goto return
971 __goto = 1;
972 break;
973 case 12:
974 // case
975 __temp1 = print;
976 __goto = 17;
977 return thenHelper(foobar(x), __body, __completer);
978 case 17:
979 // returning from await.
980 __temp1(__result);
981 __returnValue = y;
982 // goto return
983 __goto = 1;
984 break;
985 case 14:
986 // case
987 if (a) {
988 throw new Error();
989 } else {
1065 // goto while condition 990 // goto while condition
1066 __goto = 3; 991 __goto = 3;
1067 break; 992 break;
1068 case 4: 993 }
1069 // after while 994 case 15:
1070 case 1: 995 // default
1071 // return 996 // goto break lab
1072 return thenHelper(__returnValue, 0, __completer, null); 997 __goto = 6;
1073 case 2: 998 break;
1074 // rethrow 999 case 9:
1075 return thenHelper(__currentError, 1, __completer); 1000 // after switch
1076 } 1001 foo();
1077 } catch (__error) { 1002 case 6:
1078 __currentError = __error; 1003 // break lab
1079 __goto = __handler; 1004 // goto while condition
1005 __goto = 3;
1006 break;
1007 case 4:
1008 // after while
1009 case 1:
1010 // return
1011 return thenHelper(__returnValue, 0, __completer, null);
1012 case 2:
1013 // rethrow
1014 return thenHelper(__currentError, 1, __completer);
1080 } 1015 }
1081
1082 } 1016 }
1083 return thenHelper(null, __body, __completer, null); 1017 return thenHelper(null, __body, __completer, null);
1084 }"""); 1018 }""");
1085 } 1019 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698