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

Unified Diff: pkg/compiler/lib/src/js/rewrite_async.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 | « no previous file | tests/compiler/dart2js/async_await_js_transform_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/js/rewrite_async.dart
diff --git a/pkg/compiler/lib/src/js/rewrite_async.dart b/pkg/compiler/lib/src/js/rewrite_async.dart
index c2863c5d895c9e32fc00dcc6819e9818b200cf4d..65408295e6f8bb56e49fc736df550a4b5c8143f6 100644
--- a/pkg/compiler/lib/src/js/rewrite_async.dart
+++ b/pkg/compiler/lib/src/js/rewrite_async.dart
@@ -2412,7 +2412,10 @@ class PreTranslationAnalysis extends js.NodeVisitor<bool> {
@override
bool visitSwitch(js.Switch node) {
loopsAndSwitches.add(node);
- bool result = visit(node.key);
+ // If the key has an `await` expression, do not transform the
+ // body of the switch.
+ visit(node.key);
+ bool result = false;
for (js.SwitchClause clause in node.cases) {
if (visit(clause)) result = true;
}
« no previous file with comments | « no previous file | tests/compiler/dart2js/async_await_js_transform_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698