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

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

Issue 994853003: Fix dart2js for switches in async code with only awaits in the key. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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/compiler/lib/src/js/rewrite_async.dart ('k') | tests/language/async_switch_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 c301f6a81f4f31c6e2a7a5a96d1567d0633eb0be..2483ceb0dbf5475acccb7df1089b994eb472a777 100644
--- a/tests/compiler/dart2js/async_await_js_transform_test.dart
+++ b/tests/compiler/dart2js/async_await_js_transform_test.dart
@@ -1015,4 +1015,52 @@ function(x, y, k) {
}
return thenHelper(null, __body, __completer, null);
}""");
+ testTransform("""
+ function(l) async {
+ switch(await l) {
+ case 1:
+ print(1);
+ break;
+ case 2:
+ print(1);
+ // Fallthrough
+ default:
+ print(2);
+ break;
+ }
+ }""", """
+function(l) {
+ var __goto = 0, __completer = new Completer(), __handler = 1, __currentError;
+ function __body(__errorCode, __result) {
+ if (__errorCode === 1) {
+ __currentError = __result;
+ __goto = __handler;
+ }
+ while (true)
+ switch (__goto) {
+ case 0:
+ // Function start
+ __goto = 2;
+ return thenHelper(l, __body, __completer);
+ case 2:
+ // returning from await.
+ switch (__result) {
+ case 1:
+ print(1);
+ break;
+ case 2:
+ print(1);
+ default:
+ print(2);
+ break;
+ }
+ // 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/compiler/lib/src/js/rewrite_async.dart ('k') | tests/language/async_switch_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698