| 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 class Unparser implements Visitor { | 5 class Unparser implements Visitor { |
| 6 final Renamer renamer; | 6 final Renamer renamer; |
| 7 StringBuffer sb; | 7 StringBuffer sb; |
| 8 | 8 |
| 9 Unparser([this.renamer = const Renamer()]); | 9 Unparser([this.renamer = const Renamer()]); |
| 10 | 10 |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 visit(node.elements); | 187 visit(node.elements); |
| 188 } | 188 } |
| 189 | 189 |
| 190 visitModifiers(Modifiers node) => node.visitChildren(this); | 190 visitModifiers(Modifiers node) => node.visitChildren(this); |
| 191 | 191 |
| 192 /** | 192 /** |
| 193 * Unparses given NodeList starting from specific node. | 193 * Unparses given NodeList starting from specific node. |
| 194 */ | 194 */ |
| 195 unparseNodeListFrom(NodeList node, Link<Node> from) { | 195 unparseNodeListFrom(NodeList node, Link<Node> from) { |
| 196 if (from.isEmpty()) return; | 196 if (from.isEmpty()) return; |
| 197 String delimiter = (node.delimiter === null) ? " " : "${node.delimiter} "; | 197 String delimiter = (node.delimiter === null) ? " " : "${node.delimiter}"; |
| 198 visit(from.head); | 198 visit(from.head); |
| 199 for (Link link = from.tail; !link.isEmpty(); link = link.tail) { | 199 for (Link link = from.tail; !link.isEmpty(); link = link.tail) { |
| 200 sb.add(delimiter); | 200 sb.add(delimiter); |
| 201 visit(link.head); | 201 visit(link.head); |
| 202 } | 202 } |
| 203 } | 203 } |
| 204 | 204 |
| 205 visitNodeList(NodeList node) { | 205 visitNodeList(NodeList node) { |
| 206 if (node.beginToken !== null) add(node.beginToken.value); | 206 if (node.beginToken !== null) add(node.beginToken.value); |
| 207 if (node.nodes !== null) { | 207 if (node.nodes !== null) { |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 513 sb.add(' '); | 513 sb.add(' '); |
| 514 } | 514 } |
| 515 visit(node.name); | 515 visit(node.name); |
| 516 if (node.typeParameters !== null) { | 516 if (node.typeParameters !== null) { |
| 517 visit(node.typeParameters); | 517 visit(node.typeParameters); |
| 518 } | 518 } |
| 519 visit(node.formals); | 519 visit(node.formals); |
| 520 add(node.endToken.value); | 520 add(node.endToken.value); |
| 521 } | 521 } |
| 522 } | 522 } |
| OLD | NEW |