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

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

Issue 10945032: Force a space after empty list literal. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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
« no previous file with comments | « no previous file | tests/co19/co19-dart2dart.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 String unparse(Node node) { 8 String unparse(Node node) {
9 Unparser unparser = new Unparser(); 9 Unparser unparser = new Unparser();
10 unparser.unparse(node); 10 unparser.unparse(node);
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 213
214 visitNewExpression(NewExpression node) { 214 visitNewExpression(NewExpression node) {
215 addToken(node.newToken); 215 addToken(node.newToken);
216 visit(node.send); 216 visit(node.send);
217 } 217 }
218 218
219 visitLiteralList(LiteralList node) { 219 visitLiteralList(LiteralList node) {
220 if (node.constKeyword !== null) add(node.constKeyword.value); 220 if (node.constKeyword !== null) add(node.constKeyword.value);
221 visit(node.typeArguments); 221 visit(node.typeArguments);
222 visit(node.elements); 222 visit(node.elements);
223 // If list is empty, emit space after [] to disambiguate cases like []==[].
224 if (node.elements.isEmpty()) sb.add(' ');
223 } 225 }
224 226
225 visitModifiers(Modifiers node) => node.visitChildren(this); 227 visitModifiers(Modifiers node) => node.visitChildren(this);
226 228
227 /** 229 /**
228 * Unparses given NodeList starting from specific node. 230 * Unparses given NodeList starting from specific node.
229 */ 231 */
230 unparseNodeListFrom(NodeList node, Link<Node> from) { 232 unparseNodeListFrom(NodeList node, Link<Node> from) {
231 if (from.isEmpty()) return; 233 if (from.isEmpty()) return;
232 String delimiter = (node.delimiter === null) ? "" : "${node.delimiter}"; 234 String delimiter = (node.delimiter === null) ? "" : "${node.delimiter}";
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 sb.add(' '); 509 sb.add(' ');
508 } 510 }
509 visit(node.name); 511 visit(node.name);
510 if (node.typeParameters !== null) { 512 if (node.typeParameters !== null) {
511 visit(node.typeParameters); 513 visit(node.typeParameters);
512 } 514 }
513 visit(node.formals); 515 visit(node.formals);
514 add(node.endToken.value); 516 add(node.endToken.value);
515 } 517 }
516 } 518 }
OLDNEW
« no previous file with comments | « no previous file | tests/co19/co19-dart2dart.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698