From 3c542251e04cd85903ec12f5747c86d5c6c1a867 Mon Sep 17 00:00:00 2001 From: Eugene Burmako Date: Wed, 19 Sep 2012 13:01:40 +0200 Subject: SI-6390 removes Trees#ArrayValue from the API Introduced by uncurry - therefore it can be seen neither by macros, nor by runtime reflection. Despite never being pickled, ArrayValue is supported by unpickler so I couldn't move it exclusively to scala-compiler.jar. Figuring out the mysterious reason for pickling ArrayValue is left to future work. --- src/library/scala/reflect/base/Base.scala | 5 --- src/library/scala/reflect/base/Trees.scala | 42 +++----------------------- src/reflect/scala/reflect/api/Trees.scala | 9 ------ src/reflect/scala/reflect/internal/Trees.scala | 22 +++++++++++--- 4 files changed, 23 insertions(+), 55 deletions(-) (limited to 'src') diff --git a/src/library/scala/reflect/base/Base.scala b/src/library/scala/reflect/base/Base.scala index 6ecfd384ab..7cbc39a3b6 100644 --- a/src/library/scala/reflect/base/Base.scala +++ b/src/library/scala/reflect/base/Base.scala @@ -571,10 +571,6 @@ class Base extends Universe { self => extends TermTree object UnApply extends UnApplyExtractor - case class ArrayValue(elemtpt: Tree, elems: List[Tree]) - extends TermTree - object ArrayValue extends ArrayValueExtractor - case class Function(vparams: List[ValDef], body: Tree) extends TermTree with SymTree object Function extends FunctionExtractor @@ -711,7 +707,6 @@ class Base extends Universe { self => implicit val StarTag = ClassTag[Star](classOf[Star]) implicit val BindTag = ClassTag[Bind](classOf[Bind]) implicit val UnApplyTag = ClassTag[UnApply](classOf[UnApply]) - implicit val ArrayValueTag = ClassTag[ArrayValue](classOf[ArrayValue]) implicit val FunctionTag = ClassTag[Function](classOf[Function]) implicit val AssignTag = ClassTag[Assign](classOf[Assign]) implicit val AssignOrNamedArgTag = ClassTag[AssignOrNamedArg](classOf[AssignOrNamedArg]) diff --git a/src/library/scala/reflect/base/Trees.scala b/src/library/scala/reflect/base/Trees.scala index 428b493478..6931d23173 100644 --- a/src/library/scala/reflect/base/Trees.scala +++ b/src/library/scala/reflect/base/Trees.scala @@ -538,7 +538,7 @@ trait Trees { self: Universe => } /** Alternatives of patterns. - * + * * Eliminated by compiler phases Eliminated by compiler phases patmat (in the new pattern matcher of 2.10) or explicitouter (in the old pre-2.10 pattern matcher), * except for * occurrences in encoded Switch stmt (i.e. remaining Match(CaseDef(...))) @@ -564,7 +564,7 @@ trait Trees { self: Universe => } /** Repetition of pattern. - * + * * Eliminated by compiler phases patmat (in the new pattern matcher of 2.10) or explicitouter (in the old pre-2.10 pattern matcher). */ type Star >: Null <: TermTree @@ -588,7 +588,7 @@ trait Trees { self: Universe => } /** Bind a variable to a rhs pattern. - * + * * Eliminated by compiler phases patmat (in the new pattern matcher of 2.10) or explicitouter (in the old pre-2.10 pattern matcher). * * @param name @@ -614,7 +614,7 @@ trait Trees { self: Universe => def unapply(bind: Bind): Option[(Name, Tree)] } - /** + /** * Used to represent `unapply` methods in pattern matching. * * For example: @@ -660,38 +660,6 @@ trait Trees { self: Universe => def unapply(unApply: UnApply): Option[(Tree, List[Tree])] } - /** An array of expressions. This AST node needs to be translated in backend. - * It is used to pass arguments to vararg arguments. - * Introduced by compiler phase uncurry. - */ - type ArrayValue >: Null <: TermTree - - /** A tag that preserves the identity of the `ArrayValue` abstract type from erasure. - * Can be used for pattern matching, instance tests, serialization and likes. - */ - implicit val ArrayValueTag: ClassTag[ArrayValue] - - /** The constructor/deconstructor for `ArrayValue` instances. */ - val ArrayValue: ArrayValueExtractor - - /** An extractor class to create and pattern match with syntax `ArrayValue(elemtpt, elems)`. - * This AST node does not have direct correspondence to Scala code, - * and is used to pass arguments to vararg arguments. For instance: - * - * printf("%s%d", foo, 42) - * - * Is translated to after compiler phase uncurry to: - * - * Apply( - * Ident("printf"), - * Literal("%s%d"), - * ArrayValue(, List(Ident("foo"), Literal(42)))) - */ - abstract class ArrayValueExtractor { - def apply(elemtpt: Tree, elems: List[Tree]): ArrayValue - def unapply(arrayValue: ArrayValue): Option[(Tree, List[Tree])] - } - /** Anonymous function, eliminated by compiler phase lambdalift */ type Function >: Null <: TermTree with SymTree @@ -705,7 +673,7 @@ trait Trees { self: Universe => /** An extractor class to create and pattern match with syntax `Function(vparams, body)`. * This AST node corresponds to the following Scala code: - * + * * vparams => body * * The symbol of a Function is a synthetic TermSymbol. diff --git a/src/reflect/scala/reflect/api/Trees.scala b/src/reflect/scala/reflect/api/Trees.scala index e46a977be8..18d960ae04 100644 --- a/src/reflect/scala/reflect/api/Trees.scala +++ b/src/reflect/scala/reflect/api/Trees.scala @@ -317,14 +317,6 @@ trait Trees extends base.Trees { self: Universe => val args: List[Tree] } - override type ArrayValue >: Null <: TermTree with ArrayValueApi - - /** The API that all array values support */ - trait ArrayValueApi extends TermTreeApi { this: ArrayValue => - val elemtpt: Tree - val elems: List[Tree] - } - override type Function >: Null <: TermTree with SymTree with FunctionApi /** The API that all functions support */ @@ -565,7 +557,6 @@ trait Trees extends base.Trees { self: Universe => def Star(tree: Tree, elem: Tree): Star def Bind(tree: Tree, name: Name, body: Tree): Bind def UnApply(tree: Tree, fun: Tree, args: List[Tree]): UnApply - def ArrayValue(tree: Tree, elemtpt: Tree, trees: List[Tree]): ArrayValue def Function(tree: Tree, vparams: List[ValDef], body: Tree): Function def Assign(tree: Tree, lhs: Tree, rhs: Tree): Assign def AssignOrNamedArg(tree: Tree, lhs: Tree, rhs: Tree): AssignOrNamedArg diff --git a/src/reflect/scala/reflect/internal/Trees.scala b/src/reflect/scala/reflect/internal/Trees.scala index 5a6d6ce7c7..8e91431220 100644 --- a/src/reflect/scala/reflect/internal/Trees.scala +++ b/src/reflect/scala/reflect/internal/Trees.scala @@ -328,9 +328,23 @@ trait Trees extends api.Trees { self: SymbolTable => extends TermTree with UnApplyApi object UnApply extends UnApplyExtractor - case class ArrayValue(elemtpt: Tree, elems: List[Tree]) - extends TermTree with ArrayValueApi - object ArrayValue extends ArrayValueExtractor + /** An array of expressions. This AST node needs to be translated in backend. + * It is used to pass arguments to vararg arguments. + * Introduced by compiler phase uncurry. + * + * This AST node does not have direct correspondence to Scala code, + * and is used to pass arguments to vararg arguments. For instance: + * + * printf("%s%d", foo, 42) + * + * Is translated to after compiler phase uncurry to: + * + * Apply( + * Ident("printf"), + * Literal("%s%d"), + * ArrayValue(, List(Ident("foo"), Literal(42)))) + */ + case class ArrayValue(elemtpt: Tree, elems: List[Tree]) extends TermTree case class Function(vparams: List[ValDef], body: Tree) extends SymTree with TermTree with FunctionApi @@ -497,6 +511,7 @@ trait Trees extends api.Trees { self: SymbolTable => override type TreeCopier <: InternalTreeCopierOps abstract class InternalTreeCopierOps extends TreeCopierOps { def ApplyDynamic(tree: Tree, qual: Tree, args: List[Tree]): ApplyDynamic + def ArrayValue(tree: Tree, elemtpt: Tree, trees: List[Tree]): ArrayValue } class StrictTreeCopier extends InternalTreeCopierOps { @@ -1574,7 +1589,6 @@ trait Trees extends api.Trees { self: SymbolTable => implicit val StarTag = ClassTag[Star](classOf[Star]) implicit val BindTag = ClassTag[Bind](classOf[Bind]) implicit val UnApplyTag = ClassTag[UnApply](classOf[UnApply]) - implicit val ArrayValueTag = ClassTag[ArrayValue](classOf[ArrayValue]) implicit val FunctionTag = ClassTag[Function](classOf[Function]) implicit val AssignTag = ClassTag[Assign](classOf[Assign]) implicit val AssignOrNamedArgTag = ClassTag[AssignOrNamedArg](classOf[AssignOrNamedArg]) -- cgit v1.2.3