summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Burmako <xeno.by@gmail.com>2012-09-14 13:49:18 +0200
committerEugene Burmako <xeno.by@gmail.com>2012-09-14 20:55:40 +0200
commitdb306cb526b941ed30613d9acf1c0958dd1405f7 (patch)
tree3366d43ee574c41865f810d27c45e82ad91079e5
parent83c1b1062957e50e5336c1b3409e54e0a5cce275 (diff)
downloadscala-db306cb526b941ed30613d9acf1c0958dd1405f7.tar.gz
scala-db306cb526b941ed30613d9acf1c0958dd1405f7.tar.bz2
scala-db306cb526b941ed30613d9acf1c0958dd1405f7.zip
SI-6373 removes Trees#ApplyDynamic from the API
Introduced by erasure - therefore it can be seen neither by macros, nor by runtime reflection. Despite never being pickled, ApplyDynamic is supported by unpickler so I couldn't move it exclusively to scala-compiler.jar. Figuring out the mysterious reason for pickling ApplyDynamic is left to future work.
-rw-r--r--src/compiler/scala/tools/nsc/ast/Trees.scala2
-rw-r--r--src/library/scala/reflect/base/Base.scala5
-rw-r--r--src/library/scala/reflect/base/Trees.scala30
-rw-r--r--src/reflect/scala/reflect/api/Trees.scala9
-rw-r--r--src/reflect/scala/reflect/internal/Trees.scala14
-rw-r--r--src/reflect/scala/reflect/runtime/JavaUniverse.scala2
6 files changed, 10 insertions, 52 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/Trees.scala b/src/compiler/scala/tools/nsc/ast/Trees.scala
index 4e643e6f32..ea1b26469b 100644
--- a/src/compiler/scala/tools/nsc/ast/Trees.scala
+++ b/src/compiler/scala/tools/nsc/ast/Trees.scala
@@ -178,7 +178,7 @@ trait Trees extends scala.reflect.internal.Trees { self: Global =>
case _ => super.xtraverse(traverser, tree)
}
- trait TreeCopier extends super.TreeCopierOps {
+ trait TreeCopier extends super.InternalTreeCopierOps {
def DocDef(tree: Tree, comment: DocComment, definition: Tree): DocDef
def SelectFromArray(tree: Tree, qualifier: Tree, selector: Name, erasure: Type): SelectFromArray
def InjectDerivedValue(tree: Tree, arg: Tree): InjectDerivedValue
diff --git a/src/library/scala/reflect/base/Base.scala b/src/library/scala/reflect/base/Base.scala
index 33582675bd..65e9f4c335 100644
--- a/src/library/scala/reflect/base/Base.scala
+++ b/src/library/scala/reflect/base/Base.scala
@@ -623,10 +623,6 @@ class Base extends Universe { self =>
extends GenericApply
object Apply extends ApplyExtractor
- case class ApplyDynamic(qual: Tree, args: List[Tree])
- extends TermTree with SymTree
- object ApplyDynamic extends ApplyDynamicExtractor
-
case class Super(qual: Tree, mix: TypeName) extends TermTree
object Super extends SuperExtractor
@@ -725,7 +721,6 @@ class Base extends Universe { self =>
implicit val GenericApplyTag = ClassTag[GenericApply](classOf[GenericApply])
implicit val TypeApplyTag = ClassTag[TypeApply](classOf[TypeApply])
implicit val ApplyTag = ClassTag[Apply](classOf[Apply])
- implicit val ApplyDynamicTag = ClassTag[ApplyDynamic](classOf[ApplyDynamic])
implicit val SuperTag = ClassTag[Super](classOf[Super])
implicit val ThisTag = ClassTag[This](classOf[This])
implicit val SelectTag = ClassTag[Select](classOf[Select])
diff --git a/src/library/scala/reflect/base/Trees.scala b/src/library/scala/reflect/base/Trees.scala
index 224965a2b7..74928a0cc6 100644
--- a/src/library/scala/reflect/base/Trees.scala
+++ b/src/library/scala/reflect/base/Trees.scala
@@ -971,36 +971,6 @@ trait Trees { self: Universe =>
def unapply(apply: Apply): Option[(Tree, List[Tree])]
}
- /** Dynamic value application.
- * In a dynamic application q.f(as)
- * - q is stored in qual
- * - as is stored in args
- * - f is stored as the node's symbol field.
- * [Eugene++] what is it used for?
- * Introduced by erasure, eliminated by cleanup.
- */
- type ApplyDynamic >: Null <: TermTree with SymTree
-
- /** A tag that preserves the identity of the `ApplyDynamic` abstract type from erasure.
- * Can be used for pattern matching, instance tests, serialization and likes.
- */
- implicit val ApplyDynamicTag: ClassTag[ApplyDynamic]
-
- /** The constructor/deconstructor for `ApplyDynamic` instances. */
- val ApplyDynamic: ApplyDynamicExtractor
-
- /** An extractor class to create and pattern match with syntax `ApplyDynamic(qual, args)`.
- * This AST node corresponds to the following Scala code:
- *
- * fun(args)
- *
- * The symbol of an ApplyDynamic is the function symbol of `qual`, or NoSymbol, if there is none.
- */
- abstract class ApplyDynamicExtractor {
- def apply(qual: Tree, args: List[Tree]): ApplyDynamic
- def unapply(applyDynamic: ApplyDynamic): Option[(Tree, List[Tree])]
- }
-
/** Super reference, qual = corresponding this reference
* A super reference C.super[M] is represented as Super(This(C), M).
*/
diff --git a/src/reflect/scala/reflect/api/Trees.scala b/src/reflect/scala/reflect/api/Trees.scala
index 5522693b29..e46a977be8 100644
--- a/src/reflect/scala/reflect/api/Trees.scala
+++ b/src/reflect/scala/reflect/api/Trees.scala
@@ -424,14 +424,6 @@ trait Trees extends base.Trees { self: Universe =>
trait ApplyApi extends GenericApplyApi { this: Apply =>
}
- override type ApplyDynamic >: Null <: TermTree with SymTree with ApplyDynamicApi
-
- /** The API that all apply dynamics support */
- trait ApplyDynamicApi extends TermTreeApi with SymTreeApi { this: ApplyDynamic =>
- val qual: Tree
- val args: List[Tree]
- }
-
override type Super >: Null <: TermTree with SuperApi
/** The API that all supers support */
@@ -586,7 +578,6 @@ trait Trees extends base.Trees { self: Universe =>
def Typed(tree: Tree, expr: Tree, tpt: Tree): Typed
def TypeApply(tree: Tree, fun: Tree, args: List[Tree]): TypeApply
def Apply(tree: Tree, fun: Tree, args: List[Tree]): Apply
- def ApplyDynamic(tree: Tree, qual: Tree, args: List[Tree]): ApplyDynamic
def Super(tree: Tree, qual: Tree, mix: TypeName): Super
def This(tree: Tree, qual: Name): This
def Select(tree: Tree, qualifier: Tree, selector: Name): Select
diff --git a/src/reflect/scala/reflect/internal/Trees.scala b/src/reflect/scala/reflect/internal/Trees.scala
index a59f01155a..b20c315a2a 100644
--- a/src/reflect/scala/reflect/internal/Trees.scala
+++ b/src/reflect/scala/reflect/internal/Trees.scala
@@ -400,9 +400,7 @@ trait Trees extends api.Trees { self: SymbolTable =>
def ApplyConstructor(tpt: Tree, args: List[Tree]) = Apply(Select(New(tpt), nme.CONSTRUCTOR), args)
- case class ApplyDynamic(qual: Tree, args: List[Tree])
- extends SymTree with TermTree with ApplyDynamicApi
- object ApplyDynamic extends ApplyDynamicExtractor
+ case class ApplyDynamic(qual: Tree, args: List[Tree]) extends SymTree with TermTree
case class Super(qual: Tree, mix: TypeName) extends TermTree with SuperApi {
override def symbol: Symbol = qual.symbol
@@ -496,7 +494,12 @@ trait Trees extends api.Trees { self: SymbolTable =>
def TypeTree(tp: Type): TypeTree = TypeTree() setType tp
- class StrictTreeCopier extends TreeCopierOps {
+ override type TreeCopier <: InternalTreeCopierOps
+ abstract class InternalTreeCopierOps extends TreeCopierOps {
+ def ApplyDynamic(tree: Tree, qual: Tree, args: List[Tree]): ApplyDynamic
+ }
+
+ class StrictTreeCopier extends InternalTreeCopierOps {
def ClassDef(tree: Tree, mods: Modifiers, name: Name, tparams: List[TypeDef], impl: Template) =
new ClassDef(mods, name.toTypeName, tparams, impl).copyAttrs(tree)
def PackageDef(tree: Tree, pid: RefTree, stats: List[Tree]) =
@@ -590,7 +593,7 @@ trait Trees extends api.Trees { self: SymbolTable =>
new ExistentialTypeTree(tpt, whereClauses).copyAttrs(tree)
}
- class LazyTreeCopier extends TreeCopierOps {
+ class LazyTreeCopier extends InternalTreeCopierOps {
val treeCopy: TreeCopier = newStrictTreeCopier
def ClassDef(tree: Tree, mods: Modifiers, name: Name, tparams: List[TypeDef], impl: Template) = tree match {
case t @ ClassDef(mods0, name0, tparams0, impl0)
@@ -1585,7 +1588,6 @@ trait Trees extends api.Trees { self: SymbolTable =>
implicit val GenericApplyTag = ClassTag[GenericApply](classOf[GenericApply])
implicit val TypeApplyTag = ClassTag[TypeApply](classOf[TypeApply])
implicit val ApplyTag = ClassTag[Apply](classOf[Apply])
- implicit val ApplyDynamicTag = ClassTag[ApplyDynamic](classOf[ApplyDynamic])
implicit val SuperTag = ClassTag[Super](classOf[Super])
implicit val ThisTag = ClassTag[This](classOf[This])
implicit val SelectTag = ClassTag[Select](classOf[Select])
diff --git a/src/reflect/scala/reflect/runtime/JavaUniverse.scala b/src/reflect/scala/reflect/runtime/JavaUniverse.scala
index 77d65a7db2..1d875b10f1 100644
--- a/src/reflect/scala/reflect/runtime/JavaUniverse.scala
+++ b/src/reflect/scala/reflect/runtime/JavaUniverse.scala
@@ -16,7 +16,7 @@ class JavaUniverse extends internal.SymbolTable with ReflectSetup with runtime.S
def log(msg: => AnyRef): Unit = println(" [] "+msg)
- type TreeCopier = TreeCopierOps
+ type TreeCopier = InternalTreeCopierOps
def newStrictTreeCopier: TreeCopier = new StrictTreeCopier
def newLazyTreeCopier: TreeCopier = new LazyTreeCopier