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

Unified Diff: tests/compiler/dart2js/async_await_js_transform_test.dart

Issue 1012783002: Fix renaming of exception variables on left-hand-sides. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix also the dynamic type... Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/js_ast/lib/src/nodes.dart ('k') | tests/language/async_await_catch_regression_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
+ 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);
+}""");
}
« no previous file with comments | « pkg/js_ast/lib/src/nodes.dart ('k') | tests/language/async_await_catch_regression_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698