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

Unified Diff: pkg/compiler/lib/src/js/rewrite_async.dart

Issue 1060293002: Fix bug in dart2js async rewrite (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 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/language/async_regression_23058_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 e23b1cf409c0e539248fb04bde35cf880d1b94fd..9ea66a2a73e77221f38d4782a9fb324fa7329bed 100644
--- a/pkg/compiler/lib/src/js/rewrite_async.dart
+++ b/pkg/compiler/lib/src/js/rewrite_async.dart
@@ -880,9 +880,9 @@ abstract class AsyncRewriterBase extends js.NodeVisitor {
@override
js.Expression visitConditional(js.Conditional node) {
if (!shouldTransform(node.then) && !shouldTransform(node.otherwise)) {
- return withExpression(node.condition, (js.Expression condition) {
- return js.js('# ? # : #', [condition, node.then, node.otherwise]);
- }, store: false);
+ return js.js('# ? # : #', [visitExpression(node.condition),
+ visitExpression(node.then),
+ visitExpression(node.otherwise)]);
}
int thenLabel = newLabel("then");
int joinLabel = newLabel("join");
@@ -969,10 +969,9 @@ abstract class AsyncRewriterBase extends js.NodeVisitor {
if (!shouldTransform(node)) {
bool oldInsideUntranslatedBreakable = insideUntranslatedBreakable;
insideUntranslatedBreakable = true;
- withExpression(node.condition, (js.Expression condition) {
- addStatement(js.js.statement('do {#} while (#)',
- [node.body, condition]));
- }, store: false);
+ addStatement(js.js.statement('do {#} while (#)',
+ [translateInBlock(node.body),
+ visitExpression(node.condition)]));
insideUntranslatedBreakable = oldInsideUntranslatedBreakable;
return;
}
@@ -1348,7 +1347,8 @@ abstract class AsyncRewriterBase extends js.NodeVisitor {
for (js.SwitchClause clause in node.cases) {
if (clause is js.Case) {
labels[i] = newLabel("case");
- clauses.add(new js.Case(clause.expression, gotoAndBreak(labels[i])));
+ clauses.add(new js.Case(visitExpression(clause.expression),
+ gotoAndBreak(labels[i])));
} else if (clause is js.Default) {
labels[i] = newLabel("default");
clauses.add(new js.Default(gotoAndBreak(labels[i])));
« no previous file with comments | « no previous file | tests/language/async_regression_23058_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698