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

Unified Diff: lib/compiler/implementation/tree/unparser.dart

Issue 10448008: fix for index operation unparses (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: fix long line Created 8 years, 7 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/tree/unparser.dart
diff --git a/lib/compiler/implementation/tree/unparser.dart b/lib/compiler/implementation/tree/unparser.dart
index 05b24260254451bb67f314f740ba13b5e4956b95..2ee401b1d781e7261b6680f2c9d3aff17f59f877 100644
--- a/lib/compiler/implementation/tree/unparser.dart
+++ b/lib/compiler/implementation/tree/unparser.dart
@@ -179,7 +179,6 @@ class Unparser implements Visitor {
if (node.endToken !== null) add(node.endToken.value);
}
-
unparseSendPart(Send node) {
if (node.isPrefix) {
visit(node.selector);
@@ -188,7 +187,7 @@ class Unparser implements Visitor {
visit(node.receiver);
if (node.selector is !Operator) sb.add('.');
}
- if (!node.isPrefix) {
+ if (!node.isPrefix && !node.isIndex) {
visit(node.selector);
}
}
@@ -198,10 +197,27 @@ class Unparser implements Visitor {
visit(node.argumentsNode);
}
- visitSendSet(SendSet node) {
- unparseSendPart(node);
+ // Special case for assignments like "list[0] = 1".
ahe 2012/05/30 10:03:12 This should be a doc comment.
Roman 2012/05/30 10:44:04 Done.
+ visitListIndexSet(SendSet node) {
ahe 2012/05/30 10:03:12 This is not a visitor method. So it should be name
Roman 2012/05/30 10:44:04 Done.
+ visit(node.receiver);
+ sb.add('[');
+ sb.add(node.arguments.head);
+ sb.add(']');
add(node.assignmentOperator.token.value);
- visit(node.argumentsNode);
+ NodeList tailArguments = new NodeList(
Roman 2012/05/30 09:09:55 not sure about this one. beginToken and endToken w
ahe 2012/05/30 10:03:12 I don't like constructing fake AST nodes just for
Roman 2012/05/30 10:44:04 Done.
+ node.argumentsNode.beginToken, node.argumentsNode.nodes.tail,
+ node.argumentsNode.endToken, node.argumentsNode.delimiter);
+ visit(tailArguments);
+ }
+
+ visitSendSet(SendSet node) {
+ if (node.isIndex) {
+ visitListIndexSet(node);
+ } else {
+ unparseSendPart(node);
+ add(node.assignmentOperator.token.value);
+ visit(node.argumentsNode);
+ }
}
visitThrow(Throw node) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698