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

Unified Diff: frog/gen.dart

Issue 8947008: When += (and similar operations) are converted to = + , (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 years 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 | frog/minfrog » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: frog/gen.dart
===================================================================
--- frog/gen.dart (revision 2468)
+++ frog/gen.dart (working copy)
@@ -1870,9 +1870,17 @@
return;
}
return x.invoke(this, name, node, new Arguments(null, [y]));
- } else {
- return _visitAssign(assignKind, node.x, node.y, node, null, isVoid);
- }
+ } else if ((assignKind != 0) && (node.y is BinaryExpression)){
+ BinaryExpression y = node.y;
+ if (TokenKind.infixPrecedence(y.op.kind) <=
+ TokenKind.infixPrecedence(assignKind)) {
jimhug 2011/12/15 17:43:18 I would prefer not to include this check. My gene
dgrove 2011/12/15 17:51:45 It doesn't any changes in minfrog, for instance. I
dgrove 2011/12/15 17:51:45 Done.
+ // This handles transforming A x= B y C => A = A x (B y C) when
+ // precedence of x >= precedence of y.
+ return _visitAssign(assignKind, node.x,
+ new ParenExpression(node.y, node.y.span), node, null, isVoid);
+ }
+ }
+ return _visitAssign(assignKind, node.x, node.y, node, null, isVoid);
}
/**
« no previous file with comments | « no previous file | frog/minfrog » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698