| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |