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

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: Also fix a too specific 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
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..ff93c3d5274873e92f8a141494293a763544f500 100644
--- a/pkg/compiler/lib/src/js/rewrite_async.dart
+++ b/pkg/compiler/lib/src/js/rewrite_async.dart
@@ -749,7 +749,10 @@ 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);
+ // visit the [js.VariableUse] to ensure renaming is done correctly.
floitsch 2015/03/17 17:01:17 Capital "V".
sigurdm 2015/03/18 14:06:24 Done.
+ return new js.Assignment.compound(visitExpression(leftHandSide),
floitsch 2015/03/17 17:01:17 Add a comment explaining that it is ok to use comp
sigurdm 2015/03/18 14:06:24 Done.
+ node.op,
+ value);
}, store: false);
} else if (leftHandSide is js.PropertyAccess) {
return withExpressions([
@@ -1211,7 +1214,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 +1236,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 +1531,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.Assignment>();
// Declaration of local variables is hoisted outside the helper but the
// initialization is done here.

Powered by Google App Engine
This is Rietveld 408576698