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 /** | 7 /** |
8 * Pretty-prints Node tree in XML-like format. | 8 * Pretty-prints Node tree in XML-like format. |
9 * | 9 * |
10 * TODO(smok): Add main() to run from command-line to print out tree for given | 10 * TODO(smok): Add main() to run from command-line to print out tree for given |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 } | 228 } |
229 | 229 |
230 visitLiteralDouble(LiteralDouble node) { | 230 visitLiteralDouble(LiteralDouble node) { |
231 printLiteral(node, "LiteralDouble"); | 231 printLiteral(node, "LiteralDouble"); |
232 } | 232 } |
233 | 233 |
234 visitLiteralInt(LiteralInt node) { | 234 visitLiteralInt(LiteralInt node) { |
235 printLiteral(node, "LiteralInt"); | 235 printLiteral(node, "LiteralInt"); |
236 } | 236 } |
237 | 237 |
238 /** Returns token string value or [null] if token is [null]. */ | 238 /** Returns token string value or [:null:] if token is [:null:]. */ |
239 tokenToStringOrNull(Token token) => token == null ? null : token.stringValue; | 239 tokenToStringOrNull(Token token) => token == null ? null : token.stringValue; |
240 | 240 |
241 visitLiteralList(LiteralList node) { | 241 visitLiteralList(LiteralList node) { |
242 openNode(node, "LiteralList", { | 242 openNode(node, "LiteralList", { |
243 "constKeyword" : tokenToStringOrNull(node.constKeyword) | 243 "constKeyword" : tokenToStringOrNull(node.constKeyword) |
244 }); | 244 }); |
245 visitChildNode(node.typeArguments, "typeArguments"); | 245 visitChildNode(node.typeArguments, "typeArguments"); |
246 visitChildNode(node.elements, "elements"); | 246 visitChildNode(node.elements, "elements"); |
247 closeNode(); | 247 closeNode(); |
248 } | 248 } |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 } | 475 } |
476 | 476 |
477 visitStringNode(StringNode node) { | 477 visitStringNode(StringNode node) { |
478 unimplemented('visitNode', node: node); | 478 unimplemented('visitNode', node: node); |
479 } | 479 } |
480 | 480 |
481 unimplemented(String message, {Node node}) { | 481 unimplemented(String message, {Node node}) { |
482 throw message; | 482 throw message; |
483 } | 483 } |
484 } | 484 } |
OLD | NEW |