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

Unified Diff: pkg/compiler/lib/src/js/rewrite_async.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 | « no previous file | pkg/js_ast/lib/src/nodes.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 8e900c015ed4c7f94f8adc0cfe02ece3ef4ea77f..83611e22ee12d17df0d40b6fba77ce9fd6ae5d7f 100644
--- a/pkg/compiler/lib/src/js/rewrite_async.dart
+++ b/pkg/compiler/lib/src/js/rewrite_async.dart
@@ -749,7 +749,12 @@ abstract class AsyncRewriterBase extends js.NodeVisitor {
js.Expression leftHandSide = node.leftHandSide;
if (leftHandSide is js.VariableUse) {
return withExpression(node.value, (js.Expression value) {
- return new js.Assignment(leftHandSide, value);
+ // A non-compound [js.Assignment] has `op==null`. So it works out to
+ // use [js.Assignment.compound] for all cases.
+ // Visit the [js.VariableUse] to ensure renaming is done correctly.
+ return new js.Assignment.compound(visitExpression(leftHandSide),
+ node.op,
+ value);
}, store: false);
} else if (leftHandSide is js.PropertyAccess) {
return withExpressions([
@@ -1211,7 +1216,7 @@ abstract class AsyncRewriterBase extends js.NodeVisitor {
if (node.op == "++" || node.op == "--") {
js.Expression argument = node.argument;
if (argument is js.VariableUse) {
- return new js.Postfix(node.op, argument);
+ return new js.Postfix(node.op, visitExpression(argument));
} else if (argument is js.PropertyAccess) {
return withExpression2(argument.receiver, argument.selector,
(receiver, selector) {
@@ -1233,7 +1238,7 @@ abstract class AsyncRewriterBase extends js.NodeVisitor {
if (node.op == "++" || node.op == "--") {
js.Expression argument = node.argument;
if (argument is js.VariableUse) {
- return new js.Prefix(node.op, argument);
+ return new js.Prefix(node.op, visitExpression(argument));
} else if (argument is js.PropertyAccess) {
return withExpression2(argument.receiver, argument.selector,
(receiver, selector) {
@@ -1528,7 +1533,7 @@ abstract class AsyncRewriterBase extends js.NodeVisitor {
@override
js.Expression visitVariableDeclarationList(js.VariableDeclarationList node) {
- List<js.Assignment> initializations = new List<js.Assignment>();
+ List<js.Expression> initializations = new List<js.Expression>();
// Declaration of local variables is hoisted outside the helper but the
// initialization is done here.
« no previous file with comments | « no previous file | pkg/js_ast/lib/src/nodes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698