summaryrefslogtreecommitdiff
path: root/src/library/scala/reflect/api/Trees.scala
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@epfl.ch>2012-04-24 19:18:12 +0200
committerAdriaan Moors <adriaan.moors@epfl.ch>2012-04-24 19:18:12 +0200
commit996f96fb3f84b87d8761cb360d441a57a3db60ee (patch)
tree6a17b342772a4b32b33ef290a3ec1fddc34fbae2 /src/library/scala/reflect/api/Trees.scala
parenta47acbc36d312cc12ab02f4564edff1deb93d941 (diff)
downloadscala-996f96fb3f84b87d8761cb360d441a57a3db60ee.tar.gz
scala-996f96fb3f84b87d8761cb360d441a57a3db60ee.tar.bz2
scala-996f96fb3f84b87d8761cb360d441a57a3db60ee.zip
TODO: use tree attachments instead of subclasses
Diffstat (limited to 'src/library/scala/reflect/api/Trees.scala')
-rw-r--r--src/library/scala/reflect/api/Trees.scala14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/library/scala/reflect/api/Trees.scala b/src/library/scala/reflect/api/Trees.scala
index 2f6dc820a5..b70ca7e0fd 100644
--- a/src/library/scala/reflect/api/Trees.scala
+++ b/src/library/scala/reflect/api/Trees.scala
@@ -663,10 +663,17 @@ trait Trees { self: Universe =>
def Apply(sym: Symbol, args: Tree*): Tree
+ // TODO remove this class, add a tree attachment to Apply to track whether implicits were involved
+ // copying trees will all too easily forget to distinguish subclasses
class ApplyToImplicitArgs(fun: Tree, args: List[Tree]) extends Apply(fun, args)
+ // TODO remove this class, add a tree attachment to Apply to track whether implicits were involved
+ // copying trees will all too easily forget to distinguish subclasses
class ApplyImplicitView(fun: Tree, args: List[Tree]) extends Apply(fun, args)
+ // TODO: use a factory method, not a class (???)
+ // as a case in point of the comment that should go here by similarity to ApplyToImplicitArgs,
+ // this tree is considered in importers, but not in treecopier
class ApplyConstructor(tpt: Tree, args: List[Tree]) extends Apply(Select(New(tpt), nme.CONSTRUCTOR), args) {
override def printingPrefix = "ApplyConstructor"
}
@@ -718,6 +725,8 @@ trait Trees { self: Universe =>
def Ident(sym: Symbol): Ident
+ // TODO remove this class, add a tree attachment to Ident to track whether it was backquoted
+ // copying trees will all too easily forget to distinguish subclasses
class BackQuotedIdent(name: Name) extends Ident(name)
/** Marks underlying reference to id as boxed.
@@ -1157,9 +1166,10 @@ trait Trees { self: Universe =>
def TypeApply(tree: Tree, fun: Tree, args: List[Tree]) =
new TypeApply(fun, args).copyAttrs(tree)
def Apply(tree: Tree, fun: Tree, args: List[Tree]) =
- (tree match {
+ (tree match { // TODO: use a tree attachment to track whether this is an apply to implicit args or a view
case _: ApplyToImplicitArgs => new ApplyToImplicitArgs(fun, args)
case _: ApplyImplicitView => new ApplyImplicitView(fun, args)
+ // TODO: ApplyConstructor ???
case _ => new Apply(fun, args)
}).copyAttrs(tree)
def ApplyDynamic(tree: Tree, qual: Tree, args: List[Tree]) =
@@ -1171,7 +1181,7 @@ trait Trees { self: Universe =>
def Select(tree: Tree, qualifier: Tree, selector: Name) =
new Select(qualifier, selector).copyAttrs(tree)
def Ident(tree: Tree, name: Name) =
- (tree match {
+ (tree match { // TODO: use a tree attachment to track whether this identifier was backquoted
case _ : BackQuotedIdent => new BackQuotedIdent(name)
case _ => new Ident(name)
}).copyAttrs(tree)