summaryrefslogtreecommitdiff
path: root/sources/scalac/ast/Tree.java.tmpl
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2003-06-04 14:53:23 +0000
committerMartin Odersky <odersky@gmail.com>2003-06-04 14:53:23 +0000
commit3a593c580c9a23b3654ea3391fb22afa85db0697 (patch)
tree193a2614a7a55cd4e5304a22e7761c88ba23f6e6 /sources/scalac/ast/Tree.java.tmpl
parent6af6dae0df106de569e9b9cf503b3350722e58eb (diff)
downloadscala-3a593c580c9a23b3654ea3391fb22afa85db0697.tar.gz
scala-3a593c580c9a23b3654ea3391fb22afa85db0697.tar.bz2
scala-3a593c580c9a23b3654ea3391fb22afa85db0697.zip
*** empty log message ***
Diffstat (limited to 'sources/scalac/ast/Tree.java.tmpl')
-rw-r--r--sources/scalac/ast/Tree.java.tmpl44
1 files changed, 5 insertions, 39 deletions
diff --git a/sources/scalac/ast/Tree.java.tmpl b/sources/scalac/ast/Tree.java.tmpl
index 65b81b905b..eaf9b7647c 100644
--- a/sources/scalac/ast/Tree.java.tmpl
+++ b/sources/scalac/ast/Tree.java.tmpl
@@ -14,6 +14,8 @@ import scalac.symtab.Symbol;
import scalac.symtab.Type;
import scalac.util.Debug;
import scalac.util.Position;
+import java.io.StringWriter;
+import scalac.ast.printer.TextTreePrinter;
{#Imports#}
public class Tree {
@@ -115,45 +117,9 @@ public class Tree {
* phase needs support for Apply, so this case got added
*/
public String toString() {
- switch (this) {
- case This(Tree qual):
- return (qual == Tree.Empty) ? "this" : qual + ".this";
- case Select(Tree qual, Name name):
- return qual + "." + name;
- case Ident(Name name):
- return name.toString();
- case Typed(Tree expr, Tree type):
- return "(" + expr + ": " + type + ")";
- case TypeApply(Tree fn, Tree[] args):
- String res = fn + "[";
- if ((args == null) || (args.length == 0))
- return res + "]";
- res += args[0].toString();
- for (int i = 1; i < args.length; i++)
- res += ", " + args[i];
- return res + "]";
- case Apply(Tree fn, Tree[] args):
- String res = fn + "(";
- if ((args == null) || (args.length == 0))
- return res + ")";
- res += args[0].toString();
- for (int i = 1; i < args.length; i++)
- res += ", " + args[i];
- return res + ")";
- case Literal(Object value):
- if (value instanceof String)
- return "\"" + value + "\"";
- else
- return value.toString();
- case Import(Tree expr, _):
- return "import " + expr;
- case Empty:
- return "<empty>";
- case TypeTerm():
- return type().toString();
- default:
- return super.toString();
- }
+ StringWriter out = new StringWriter();
+ new TextTreePrinter(out).print(this).flush();
+ return out.toString();
}
//########################################################################