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

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: 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 /**
94 * Returns this node unparsed to Dart source string.
95 */
93 toString() => unparse(false); 96 toString() => unparse(false);
94 97
98 /**
99 * Returns Xml-like tree representation of this node
100 * and Dart source string of this node.
101 */
95 toDebugString() => unparse(true); 102 toDebugString() => unparse(true);
96 103
97 String getObjectDescription() => super.toString(); 104 String getObjectDescription() => super.toString();
98 105
99 String unparse(bool printDebugInfo) { 106 String unparse(bool printDebugInfo) {
Anton Muhin 2012/06/05 09:35:19 do we really need to bundle both? I'd rather have
Roman 2012/06/05 11:09:07 I'd rather too, but there was a usage in tests tha
100 Unparser unparser = new Unparser(printDebugInfo); 107 StringBuffer sb = new StringBuffer();
108 if (printDebugInfo) {
109 PrettyPrinter prettyPrinter = new PrettyPrinter();
110 sb.add(prettyPrinter.prettyprint(this));
111 sb.add('\n');
112 }
113 Unparser unparser = new Unparser();
101 try { 114 try {
102 return unparser.unparse(this); 115 sb.add(unparser.unparse(this));
116 return sb.toString();
103 } catch (var e, var trace) { 117 } catch (var e, var trace) {
104 print(trace); 118 print(trace);
105 return '<<unparse error: ${getObjectDescription()}: ${unparser.sb}>>'; 119 return '<<unparse error: ${getObjectDescription()}: ${unparser.sb}>>';
106 } 120 }
107 } 121 }
108 122
109 abstract Token getBeginToken(); 123 abstract Token getBeginToken();
110 124
111 abstract Token getEndToken(); 125 abstract Token getEndToken();
112 126
(...skipping 1587 matching lines...) Expand 10 before | Expand all | Expand 10 after
1700 * argument). 1714 * argument).
1701 * 1715 *
1702 * TODO(ahe): This method is controversial, the team needs to discuss 1716 * TODO(ahe): This method is controversial, the team needs to discuss
1703 * if top-level methods are acceptable and what naming conventions to 1717 * if top-level methods are acceptable and what naming conventions to
1704 * use. 1718 * use.
1705 */ 1719 */
1706 initializerDo(Node node, f(Node node)) { 1720 initializerDo(Node node, f(Node node)) {
1707 SendSet send = node.asSendSet(); 1721 SendSet send = node.asSendSet();
1708 if (send !== null) return f(send.arguments.head); 1722 if (send !== null) return f(send.arguments.head);
1709 } 1723 }
OLDNEW
« no previous file with comments | « no previous file | lib/compiler/implementation/tree/unparser.dart » ('j') | lib/compiler/implementation/tree/unparser.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698