| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 DebugUnparser implements Visitor { | 5 class DebugUnparser implements Visitor { |
| 6 String separator; | 6 String separator; |
| 7 StringBuffer sb; | 7 StringBuffer sb; |
| 8 | 8 |
| 9 String unparse(Node node) { | 9 String unparse(Node node) { |
| 10 separator = ''; | 10 separator = ''; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 visit(element); | 82 visit(element); |
| 83 } | 83 } |
| 84 } | 84 } |
| 85 if (node.endToken !== null) sb.add(node.endToken); | 85 if (node.endToken !== null) sb.add(node.endToken); |
| 86 } | 86 } |
| 87 | 87 |
| 88 visitOperator(Operator node) { | 88 visitOperator(Operator node) { |
| 89 visitIdentifier(node); | 89 visitIdentifier(node); |
| 90 } | 90 } |
| 91 | 91 |
| 92 visitParameter(Parameter node) { | |
| 93 if (node.typeAnnotation !== null) { | |
| 94 visit(node.typeAnnotation); | |
| 95 sb.add(' '); | |
| 96 } | |
| 97 visit(node.name); | |
| 98 } | |
| 99 | |
| 100 visitReturn(Return node) { | 92 visitReturn(Return node) { |
| 101 node.beginToken.value.printOn(sb); | 93 node.beginToken.value.printOn(sb); |
| 102 if (node.hasExpression) { | 94 if (node.hasExpression) { |
| 103 sb.add(' '); | 95 sb.add(' '); |
| 104 visit(node.expression); | 96 visit(node.expression); |
| 105 } | 97 } |
| 106 node.endToken.value.printOn(sb); | 98 node.endToken.value.printOn(sb); |
| 107 } | 99 } |
| 108 | 100 |
| 109 visitSend(Send node) { | 101 visitSend(Send node) { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 132 visitVariableDefinitions(VariableDefinitions node) { | 124 visitVariableDefinitions(VariableDefinitions node) { |
| 133 if (node.type !== null) { | 125 if (node.type !== null) { |
| 134 visit(node.type); | 126 visit(node.type); |
| 135 sb.add(' '); | 127 sb.add(' '); |
| 136 } | 128 } |
| 137 // TODO(karlklose): print modifiers. | 129 // TODO(karlklose): print modifiers. |
| 138 visit(node.definitions, ', '); | 130 visit(node.definitions, ', '); |
| 139 sb.add('; '); | 131 sb.add('; '); |
| 140 } | 132 } |
| 141 } | 133 } |
| OLD | NEW |