diff options
author | Iulian Dragos <jaguarul@gmail.com> | 2007-08-29 10:59:03 +0000 |
---|---|---|
committer | Iulian Dragos <jaguarul@gmail.com> | 2007-08-29 10:59:03 +0000 |
commit | 042cce8cfc85ddfd1110d6811640bde9cb6f37bf (patch) | |
tree | 2bfd26c879e3deb2c957613a1f0e3a8dfa251392 | |
parent | b0f070a6aae32d6abc4481c2fcfc6b0cbf71d245 (diff) | |
download | scala-042cce8cfc85ddfd1110d6811640bde9cb6f37bf.tar.gz scala-042cce8cfc85ddfd1110d6811640bde9cb6f37bf.tar.bz2 scala-042cce8cfc85ddfd1110d6811640bde9cb6f37bf.zip |
Fixed match error in tree browser.
-rw-r--r-- | src/compiler/scala/tools/nsc/Global.scala | 6 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/ast/TreeBrowsers.scala | 38 |
2 files changed, 35 insertions, 9 deletions
diff --git a/src/compiler/scala/tools/nsc/Global.scala b/src/compiler/scala/tools/nsc/Global.scala index b550dce067..26d162cdeb 100644 --- a/src/compiler/scala/tools/nsc/Global.scala +++ b/src/compiler/scala/tools/nsc/Global.scala @@ -96,6 +96,12 @@ class Global(var settings: Settings, var reporter: Reporter) extends Trees val global: Global.this.type = Global.this } + object treeBrowsers extends TreeBrowsers { + val global: Global.this.type = Global.this + } + val treeBrowser = treeBrowsers.create() + + // val copy = new LazyTreeCopier() val comments = diff --git a/src/compiler/scala/tools/nsc/ast/TreeBrowsers.scala b/src/compiler/scala/tools/nsc/ast/TreeBrowsers.scala index 2247876a22..d91aa6fa75 100644 --- a/src/compiler/scala/tools/nsc/ast/TreeBrowsers.scala +++ b/src/compiler/scala/tools/nsc/ast/TreeBrowsers.scala @@ -27,8 +27,8 @@ import symtab.Flags._ */ abstract class TreeBrowsers { - val trees: Trees - import trees._ + val global: Global + import global._ import nme.EMPTY def create(): SwingBrowser = new SwingBrowser(); @@ -293,6 +293,9 @@ abstract class TreeBrowsers { case Bind(name, rhs) => ("Bind", name) + case UnApply(fun, args) => + ("UnApply", EMPTY) + case Match(selector, cases) => ("Visitor", EMPTY) @@ -347,6 +350,9 @@ abstract class TreeBrowsers { case Annotated(annot, arg) => ("Annotated", EMPTY) + case Annotation(constr, elements) => + ("Annotation", EMPTY) + case SingletonTypeTree(ref) => ("SingletonType", EMPTY) @@ -362,6 +368,9 @@ abstract class TreeBrowsers { case TypeBoundsTree(lo, hi) => ("TypeBoundsTree", EMPTY) + case ExistentialTypeTree(tpt, whereClauses) => + ("ExistentialTypeTree", EMPTY) + case Try(block, catcher, finalizer) => ("Try", EMPTY) @@ -373,10 +382,6 @@ abstract class TreeBrowsers { case Star(t) => ("Star", EMPTY) - - case UnApply(fn, args) => - ("Unapply", EMPTY) - } /** Return a list of children for the given tree node */ @@ -441,6 +446,9 @@ abstract class TreeBrowsers { case Bind(name, rhs) => List(rhs) + case UnApply(fun, args) => + fun :: args + case Match(selector, cases) => selector :: cases @@ -495,6 +503,9 @@ abstract class TreeBrowsers { case Annotated(annot, arg) => annot.constr :: annot.elements ::: List(arg) + case Annotation(constr, elements) => + constr :: elements + case SingletonTypeTree(ref) => List(ref) @@ -510,6 +521,9 @@ abstract class TreeBrowsers { case TypeBoundsTree(lo, hi) => List(lo, hi) + case ExistentialTypeTree(tpt, whereClauses) => + tpt :: whereClauses + case Try(block, catches, finalizer) => block :: catches ::: List(finalizer) @@ -521,9 +535,6 @@ abstract class TreeBrowsers { case Star(t) => List(t) - - case UnApply(fn,args) => - fn::args } /** Return a textual representation of this t's symbol */ @@ -659,6 +670,15 @@ abstract class TreeBrowsers { "," :/: toDocument(tp) :: ")") ) + case ExistentialType(tparams, result) => + Document.group( + Document.nest(4, "ExistentialType(" :/: + Document.group("(" :/: symsToDocument(tparams) :/: "), ") :/: + toDocument(result) :: ")")) + + case global.analyzer.ImportType(expr) => + "ImportType(" + expr.toString + ")" + case _ => throw new Error("Unknown case: " + t.toString()) } |