Chromium Code Reviews| Index: tests/compiler/dart2js/async_await_js_transform_test.dart |
| diff --git a/tests/compiler/dart2js/async_await_js_transform_test.dart b/tests/compiler/dart2js/async_await_js_transform_test.dart |
| index a1936165503bf07503b18727c7b217b14c870e2f..36aa10d6e272ed6fe96f4584150d46a0e2d0f7de 100644 |
| --- a/tests/compiler/dart2js/async_await_js_transform_test.dart |
| +++ b/tests/compiler/dart2js/async_await_js_transform_test.dart |
| @@ -597,7 +597,7 @@ function(g) { |
| return thenHelper(foo2(), __body, __completer); |
| case 11: |
| // returning from await. |
| - i = __result; |
| + i += __result; |
| // goto for condition |
| __goto = 3; |
| break; |
| @@ -1059,4 +1059,83 @@ function(l) { |
| } |
| return thenHelper(null, __body, __completer, null); |
| }"""); |
| + |
| + testTransform(""" |
| + function(m) async { |
| + var exception = 1; |
| + try { |
| + await 42; |
| + throw 42; |
| + } catch (exception) { |
| + exception = await 10; |
|
floitsch
2015/03/17 17:01:17
Apparently catch-variables are supposed to be fina
sigurdm
2015/03/18 14:06:24
This test only contains js-code extended with asyn
|
| + exception += await 10; |
| + exception++; |
| + exception--; |
| + ++exception; |
| + --exception; |
| + exception += 10; |
| + } |
| + print(exception); |
| + }""", """ |
| +function(m) { |
| + var __goto = 0, __completer = new Completer(), __handler = 1, __currentError, __next = [], exception, __exception; |
| + function __body(__errorCode, __result) { |
| + if (__errorCode === 1) { |
| + __currentError = __result; |
| + __goto = __handler; |
| + } |
| + while (true) |
| + switch (__goto) { |
| + case 0: |
| + // Function start |
| + exception = 1; |
| + __handler = 3; |
| + __goto = 6; |
| + return thenHelper(42, __body, __completer); |
| + case 6: |
| + // returning from await. |
| + throw 42; |
| + __handler = 1; |
| + // goto after finally |
| + __goto = 5; |
| + break; |
| + case 3: |
| + // catch |
| + __handler = 2; |
| + __exception = __currentError; |
| + __goto = 7; |
| + return thenHelper(10, __body, __completer); |
| + case 7: |
| + // returning from await. |
| + __exception = __result; |
| + __goto = 8; |
| + return thenHelper(10, __body, __completer); |
| + case 8: |
| + // returning from await. |
| + __exception += __result; |
| + __exception++; |
| + __exception--; |
| + ++__exception; |
| + --__exception; |
| + __exception += 10; |
| + // goto after finally |
| + __goto = 5; |
| + break; |
| + case 2: |
| + // uncaught |
| + // goto rethrow |
| + __goto = 1; |
| + break; |
| + case 5: |
| + // after finally |
| + print(exception); |
| + // implicit return |
| + return thenHelper(null, 0, __completer, null); |
| + case 1: |
| + // rethrow |
| + return thenHelper(__currentError, 1, __completer); |
| + } |
| + } |
| + return thenHelper(null, __body, __completer, null); |
| +}"""); |
| } |