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