Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(138)

Side by Side Diff: lib/compiler/implementation/tree/prettyprint.dart

Issue 10546174: Better PrettyPrinter output for Return nodes, display tokens and expression. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address Anton's comments. Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 /** 5 /**
6 * Pretty-prints Node tree in XML-like format. 6 * Pretty-prints Node tree in XML-like format.
7 * 7 *
8 * TODO(smok): Add main() to run from command-line to print out tree for given 8 * TODO(smok): Add main() to run from command-line to print out tree for given
9 * .dart file. 9 * .dart file.
10 */ 10 */
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 234
235 visitOperator(Operator node) { 235 visitOperator(Operator node) {
236 openAndCloseNode("Operator", {"value" : node.token.slowToString()}); 236 openAndCloseNode("Operator", {"value" : node.token.slowToString()});
237 } 237 }
238 238
239 visitParenthesizedExpression(ParenthesizedExpression node) { 239 visitParenthesizedExpression(ParenthesizedExpression node) {
240 visitNodeWithChildren(node, "ParenthesizedExpression"); 240 visitNodeWithChildren(node, "ParenthesizedExpression");
241 } 241 }
242 242
243 visitReturn(Return node) { 243 visitReturn(Return node) {
244 visitNodeWithChildren(node, "Return"); 244 var beginToken =
245 node.beginToken !== null ? node.beginToken.stringValue : "null";
246 var endToken = node.endToken !== null ? node.endToken.stringValue : "null";
247 openNode("Return", {"beginToken" : beginToken, "endToken" : endToken});
248 if (node.hasExpression) visitWithPrefix(node.expression, "expression:");
249 closeNode("Return");
245 } 250 }
246 251
247 visitScriptTag(ScriptTag node) { 252 visitScriptTag(ScriptTag node) {
248 visitNodeWithChildren(node, "ScriptTag"); 253 visitNodeWithChildren(node, "ScriptTag");
249 } 254 }
250 255
251 /** Custom helper to visit given node and print its type with prefix. */ 256 /** Custom helper to visit given node and print its type with prefix. */
252 visitWithPrefix(Node node, String prefix) { 257 visitWithPrefix(Node node, String prefix) {
253 nextTypePrefix = prefix; 258 nextTypePrefix = prefix;
254 node.accept(this); 259 node.accept(this);
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 } 324 }
320 325
321 visitVariableDefinitions(VariableDefinitions node) { 326 visitVariableDefinitions(VariableDefinitions node) {
322 visitNodeWithChildren(node, "VariableDefinitions"); 327 visitNodeWithChildren(node, "VariableDefinitions");
323 } 328 }
324 329
325 visitWhile(While node) { 330 visitWhile(While node) {
326 visitNodeWithChildren(node, "While"); 331 visitNodeWithChildren(node, "While");
327 } 332 }
328 } 333 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698