| 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 part of tree; | 5 part of tree; |
| 6 | 6 |
| 7 String unparse(Node node) { | 7 String unparse(Node node) { |
| 8 Unparser unparser = new Unparser(); | 8 Unparser unparser = new Unparser(); |
| 9 unparser.unparse(node); | 9 unparser.unparse(node); |
| 10 return unparser.result; | 10 return unparser.result; |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 | 116 |
| 117 visitExpressionStatement(ExpressionStatement node) { | 117 visitExpressionStatement(ExpressionStatement node) { |
| 118 visit(node.expression); | 118 visit(node.expression); |
| 119 add(node.endToken.value); | 119 add(node.endToken.value); |
| 120 } | 120 } |
| 121 | 121 |
| 122 visitFor(For node) { | 122 visitFor(For node) { |
| 123 add(node.forToken.value); | 123 add(node.forToken.value); |
| 124 sb.add('('); | 124 sb.add('('); |
| 125 visit(node.initializer); | 125 visit(node.initializer); |
| 126 if (node.initializer is !Statement) sb.add(';'); | 126 sb.add(';'); |
| 127 visit(node.conditionStatement); | 127 visit(node.conditionStatement); |
| 128 visit(node.update); | 128 visit(node.update); |
| 129 sb.add(')'); | 129 sb.add(')'); |
| 130 visit(node.body); | 130 visit(node.body); |
| 131 } | 131 } |
| 132 | 132 |
| 133 visitFunctionDeclaration(FunctionDeclaration node) { | 133 visitFunctionDeclaration(FunctionDeclaration node) { |
| 134 visit(node.function); | 134 visit(node.function); |
| 135 } | 135 } |
| 136 | 136 |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 visitVariableDefinitions(VariableDefinitions node) { | 359 visitVariableDefinitions(VariableDefinitions node) { |
| 360 visit(node.modifiers); | 360 visit(node.modifiers); |
| 361 if (!node.modifiers.nodes.isEmpty) { | 361 if (!node.modifiers.nodes.isEmpty) { |
| 362 sb.add(' '); | 362 sb.add(' '); |
| 363 } | 363 } |
| 364 if (node.type != null) { | 364 if (node.type != null) { |
| 365 visit(node.type); | 365 visit(node.type); |
| 366 sb.add(' '); | 366 sb.add(' '); |
| 367 } | 367 } |
| 368 visit(node.definitions); | 368 visit(node.definitions); |
| 369 if (node.endToken.value == const SourceString(';')) { | |
| 370 add(node.endToken.value); | |
| 371 } | |
| 372 } | 369 } |
| 373 | 370 |
| 374 visitDoWhile(DoWhile node) { | 371 visitDoWhile(DoWhile node) { |
| 375 add(node.doKeyword.value); | 372 add(node.doKeyword.value); |
| 376 if (node.body is !Block) sb.add(' '); | 373 if (node.body is !Block) sb.add(' '); |
| 377 visit(node.body); | 374 visit(node.body); |
| 378 add(node.whileKeyword.value); | 375 add(node.whileKeyword.value); |
| 379 visit(node.condition); | 376 visit(node.condition); |
| 380 sb.add(node.endToken.value); | 377 sb.add(node.endToken.value); |
| 381 } | 378 } |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 621 } | 618 } |
| 622 | 619 |
| 623 visitStatement(Statement node) { | 620 visitStatement(Statement node) { |
| 624 throw 'internal error'; // Should not be called. | 621 throw 'internal error'; // Should not be called. |
| 625 } | 622 } |
| 626 | 623 |
| 627 visitStringNode(StringNode node) { | 624 visitStringNode(StringNode node) { |
| 628 throw 'internal error'; // Should not be called. | 625 throw 'internal error'; // Should not be called. |
| 629 } | 626 } |
| 630 } | 627 } |
| OLD | NEW |