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

Side by Side Diff: dart/lib/compiler/implementation/tree/unparser.dart

Issue 10870066: Support unary - operator. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix unparser to handle that negate is no longer a keyword. Created 8 years, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // Returns null if no need to rename a node. 5 // Returns null if no need to rename a node.
6 typedef String Renamer(Node node); 6 typedef String Renamer(Node node);
7 7
8 class Unparser implements Visitor { 8 class Unparser implements Visitor {
9 Renamer rename; 9 Renamer rename;
10 StringBuffer sb; 10 StringBuffer sb;
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 // arguments. 135 // arguments.
136 if (node.name is Send) { 136 if (node.name is Send) {
137 Send send = node.name; 137 Send send = node.name;
138 assert(send is !SendSet); 138 assert(send is !SendSet);
139 if (!send.isOperator) { 139 if (!send.isOperator) {
140 // Looks like a factory method. 140 // Looks like a factory method.
141 visit(send.receiver); 141 visit(send.receiver);
142 sb.add('.'); 142 sb.add('.');
143 } else { 143 } else {
144 visit(send.receiver); 144 visit(send.receiver);
145 if (send.selector.asIdentifier().token.kind === KEYWORD_TOKEN) { 145 Identifier identifier = send.selector.asIdentifier();
146 if (identifier.token.kind === KEYWORD_TOKEN) {
147 sb.add(' ');
148 } else if (identifier.source == const SourceString('negate')) {
149 // TODO(ahe): Remove special case for negate.
146 sb.add(' '); 150 sb.add(' ');
147 } 151 }
148 } 152 }
149 visit(send.selector); 153 visit(send.selector);
150 } else { 154 } else {
151 visit(node.name); 155 visit(node.name);
152 } 156 }
153 visit(node.parameters); 157 visit(node.parameters);
154 visit(node.initializers); 158 visit(node.initializers);
155 visit(node.body); 159 visit(node.body);
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 sb.add(' '); 500 sb.add(' ');
497 } 501 }
498 visit(node.name); 502 visit(node.name);
499 if (node.typeParameters !== null) { 503 if (node.typeParameters !== null) {
500 visit(node.typeParameters); 504 visit(node.typeParameters);
501 } 505 }
502 visit(node.formals); 506 visit(node.formals);
503 add(node.endToken.value); 507 add(node.endToken.value);
504 } 508 }
505 } 509 }
OLDNEW
« no previous file with comments | « dart/lib/compiler/implementation/ssa/builder.dart ('k') | dart/lib/compiler/implementation/universe.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698