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

Unified 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, 7 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 side-by-side diff with in-line comments
Download patch
Index: lib/compiler/implementation/tree/nodes.dart
diff --git a/lib/compiler/implementation/tree/nodes.dart b/lib/compiler/implementation/tree/nodes.dart
index f5aa5adcded14326fc9d60e49603f1ca1b960fd2..3888cabe23dbb564a407b1b9cddf1e44a819b57e 100644
--- a/lib/compiler/implementation/tree/nodes.dart
+++ b/lib/compiler/implementation/tree/nodes.dart
@@ -90,16 +90,30 @@ class Node implements Hashable {
abstract visitChildren(Visitor visitor);
+ /**
+ * Returns this node unparsed to Dart source string.
+ */
toString() => unparse(false);
+ /**
+ * Returns Xml-like tree representation of this node
+ * and Dart source string of this node.
+ */
toDebugString() => unparse(true);
String getObjectDescription() => super.toString();
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
- Unparser unparser = new Unparser(printDebugInfo);
+ StringBuffer sb = new StringBuffer();
+ if (printDebugInfo) {
+ PrettyPrinter prettyPrinter = new PrettyPrinter();
+ sb.add(prettyPrinter.prettyprint(this));
+ sb.add('\n');
+ }
+ Unparser unparser = new Unparser();
try {
- return unparser.unparse(this);
+ sb.add(unparser.unparse(this));
+ return sb.toString();
} catch (var e, var trace) {
print(trace);
return '<<unparse error: ${getObjectDescription()}: ${unparser.sb}>>';
« 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