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

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

Issue 10456080: Remove printDebugInfo from Unparser (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: another PrettyPrinter interface 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
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 interface Visitor<R> { 5 interface Visitor<R> {
6 R visitBlock(Block node); 6 R visitBlock(Block node);
7 R visitBreakStatement(BreakStatement node); 7 R visitBreakStatement(BreakStatement node);
8 R visitCascade(Cascade node); 8 R visitCascade(Cascade node);
9 R visitCascadeReceiver(CascadeReceiver node); 9 R visitCascadeReceiver(CascadeReceiver node);
10 R visitCaseMatch(CaseMatch node); 10 R visitCaseMatch(CaseMatch node);
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 static int _HASH_COUNTER = 0; 83 static int _HASH_COUNTER = 0;
84 84
85 Node() : _hashCode = ++_HASH_COUNTER; 85 Node() : _hashCode = ++_HASH_COUNTER;
86 86
87 hashCode() => _hashCode; 87 hashCode() => _hashCode;
88 88
89 abstract accept(Visitor visitor); 89 abstract accept(Visitor visitor);
90 90
91 abstract visitChildren(Visitor visitor); 91 abstract visitChildren(Visitor visitor);
92 92
93 toString() => unparse(false); 93 /**
94 * Returns this node unparsed to Dart source string.
95 */
96 toString() => unparse();
94 97
95 toDebugString() => unparse(true); 98 /**
99 * Returns Xml-like tree representation of this node.
100 */
101 toDebugString() {
102 return PrettyPrinter.prettyPrint(this);
103 }
96 104
97 String getObjectDescription() => super.toString(); 105 String getObjectDescription() => super.toString();
98 106
99 String unparse(bool printDebugInfo) { 107 String unparse() {
100 Unparser unparser = new Unparser(printDebugInfo); 108 Unparser unparser = new Unparser();
101 try { 109 try {
102 return unparser.unparse(this); 110 return unparser.unparse(this);
103 } catch (var e, var trace) { 111 } catch (var e, var trace) {
104 print(trace); 112 print(trace);
105 return '<<unparse error: ${getObjectDescription()}: ${unparser.sb}>>'; 113 return '<<unparse error: ${getObjectDescription()}: ${unparser.sb}>>';
106 } 114 }
107 } 115 }
108 116
109 abstract Token getBeginToken(); 117 abstract Token getBeginToken();
110 118
(...skipping 1590 matching lines...) Expand 10 before | Expand all | Expand 10 after
1701 * argument). 1709 * argument).
1702 * 1710 *
1703 * TODO(ahe): This method is controversial, the team needs to discuss 1711 * TODO(ahe): This method is controversial, the team needs to discuss
1704 * if top-level methods are acceptable and what naming conventions to 1712 * if top-level methods are acceptable and what naming conventions to
1705 * use. 1713 * use.
1706 */ 1714 */
1707 initializerDo(Node node, f(Node node)) { 1715 initializerDo(Node node, f(Node node)) {
1708 SendSet send = node.asSendSet(); 1716 SendSet send = node.asSendSet();
1709 if (send !== null) return f(send.arguments.head); 1717 if (send !== null) return f(send.arguments.head);
1710 } 1718 }
OLDNEW
« no previous file with comments | « no previous file | lib/compiler/implementation/tree/unparser.dart » ('j') | lib/compiler/implementation/tree_validator.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698