| 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 StringBuffer sb; | 6 StringBuffer sb; |
| 7 | 7 |
| 8 Unparser(); | 8 Unparser(); |
| 9 | 9 |
| 10 String unparse(Node node) { | 10 String unparse(Node node) { |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 | 269 |
| 270 visitTypeVariable(TypeVariable node) { | 270 visitTypeVariable(TypeVariable node) { |
| 271 visit(node.name); | 271 visit(node.name); |
| 272 if (node.bound !== null) { | 272 if (node.bound !== null) { |
| 273 sb.add(' extends '); | 273 sb.add(' extends '); |
| 274 visit(node.bound); | 274 visit(node.bound); |
| 275 } | 275 } |
| 276 } | 276 } |
| 277 | 277 |
| 278 visitVariableDefinitions(VariableDefinitions node) { | 278 visitVariableDefinitions(VariableDefinitions node) { |
| 279 visit(node.modifiers); |
| 280 if (node.modifiers.nodes.length() > 0) { |
| 281 sb.add(' '); |
| 282 } |
| 279 if (node.type !== null) { | 283 if (node.type !== null) { |
| 280 visit(node.type); | 284 visit(node.type); |
| 281 } else { | 285 sb.add(' '); |
| 282 sb.add('var'); | |
| 283 } | 286 } |
| 284 sb.add(' '); | |
| 285 // TODO(karlklose): print modifiers. | |
| 286 visit(node.definitions); | 287 visit(node.definitions); |
| 287 if (node.endToken.value == const SourceString(';')) { | 288 if (node.endToken.value == const SourceString(';')) { |
| 288 add(node.endToken.value); | 289 add(node.endToken.value); |
| 289 } | 290 } |
| 290 } | 291 } |
| 291 | 292 |
| 292 visitDoWhile(DoWhile node) { | 293 visitDoWhile(DoWhile node) { |
| 293 add(node.doKeyword.value); | 294 add(node.doKeyword.value); |
| 294 sb.add(' '); | 295 sb.add(' '); |
| 295 visit(node.body); | 296 visit(node.body); |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 sb.add(' '); | 458 sb.add(' '); |
| 458 } | 459 } |
| 459 visit(node.name); | 460 visit(node.name); |
| 460 if (node.typeParameters !== null) { | 461 if (node.typeParameters !== null) { |
| 461 visit(node.typeParameters); | 462 visit(node.typeParameters); |
| 462 } | 463 } |
| 463 visit(node.formals); | 464 visit(node.formals); |
| 464 add(node.endToken.value); | 465 add(node.endToken.value); |
| 465 } | 466 } |
| 466 } | 467 } |
| OLD | NEW |