diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2012-09-26 10:40:29 +0200 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2012-09-27 15:53:17 +0200 |
commit | a79ba085c5304e304e617c7d95520d25e955d88f (patch) | |
tree | 1ccc5b27811285f75aca3daecf0c7217ccb1df19 | |
parent | 02f980c617192fcee84813805e9875f8dfb88fa5 (diff) | |
download | scala-a79ba085c5304e304e617c7d95520d25e955d88f.tar.gz scala-a79ba085c5304e304e617c7d95520d25e955d88f.tar.bz2 scala-a79ba085c5304e304e617c7d95520d25e955d88f.zip |
moves Context.runtimeUniverse to TreeBuild.mkRuntimeUniverseRef
Scaladoc-driven cleanup for the win
6 files changed, 11 insertions, 12 deletions
diff --git a/src/compiler/scala/reflect/macros/runtime/Reifiers.scala b/src/compiler/scala/reflect/macros/runtime/Reifiers.scala index f15a7ad502..9e11e5e26d 100644 --- a/src/compiler/scala/reflect/macros/runtime/Reifiers.scala +++ b/src/compiler/scala/reflect/macros/runtime/Reifiers.scala @@ -13,8 +13,6 @@ trait Reifiers { import universe._ import definitions._ - lazy val runtimeUniverse: Tree = gen.mkRuntimeUniverseRef - def reifyTree(universe: Tree, mirror: Tree, tree: Tree): Tree = { assert(ExprClass != NoSymbol) val result = scala.reflect.reify.`package`.reifyTree(self.universe)(callsiteTyper, universe, mirror, tree) diff --git a/src/reflect/scala/reflect/macros/Reifiers.scala b/src/reflect/scala/reflect/macros/Reifiers.scala index 38daa9e7b2..ed31663c68 100644 --- a/src/reflect/scala/reflect/macros/Reifiers.scala +++ b/src/reflect/scala/reflect/macros/Reifiers.scala @@ -4,16 +4,11 @@ package macros trait Reifiers { self: Context => - /** Reification prefix that refers to the runtime reflexive universe, ``scala.reflect.runtime.universe''. - * Providing it for the ``prefix'' parameter of ``reifyTree'' or ``reifyType'' will create a full-fledged tree that can be inspected at runtime. - */ - val runtimeUniverse: Tree - /** Given a tree, generate a tree that when compiled and executed produces the original tree. * For more information and examples see the documentation for ``Universe.reify''. * * The produced tree will be bound to the specified ``universe'' and ``mirror''. - * Possible values for ``universe'' include ``runtimeUniverse''. + * Possible values for ``universe'' include ``universe.treeBuild.mkRuntimeUniverseRef''. * Possible values for ``mirror'' include ``EmptyTree'' (in that case the reifier will automatically pick an appropriate mirror). * * This function is deeply connected to ``Universe.reify'', a macro that reifies arbitrary expressions into runtime trees. diff --git a/src/reflect/scala/reflect/macros/TreeBuilder.scala b/src/reflect/scala/reflect/macros/TreeBuilder.scala index ca29194859..5f18ab9ee8 100644 --- a/src/reflect/scala/reflect/macros/TreeBuilder.scala +++ b/src/reflect/scala/reflect/macros/TreeBuilder.scala @@ -53,4 +53,7 @@ abstract class TreeBuilder { def mkMethodCall(receiver: Tree, method: Symbol, targs: List[Type], args: List[Tree]): Tree def mkMethodCall(target: Tree, targs: List[Type], args: List[Tree]): Tree def mkNullaryCall(method: Symbol, targs: List[Type]): Tree + + /** A tree that refers to the runtime reflexive universe, ``scala.reflect.runtime.universe''. */ + def mkRuntimeUniverseRef: Tree } diff --git a/test/files/run/macro-reify-nested-a/Impls_Macros_1.scala b/test/files/run/macro-reify-nested-a/Impls_Macros_1.scala index ae2def2d3e..b4351c2c53 100644 --- a/test/files/run/macro-reify-nested-a/Impls_Macros_1.scala +++ b/test/files/run/macro-reify-nested-a/Impls_Macros_1.scala @@ -23,9 +23,10 @@ case class Utils[C <: Context]( c:C ) { object QueryableMacros{ def _helper[C <: Context,S:c.WeakTypeTag]( c:C )( name:String, projection:c.Expr[_] ) = { import c.universe._ + import treeBuild._ val element_type = implicitly[c.WeakTypeTag[S]].tpe val foo = c.Expr[ru.Expr[Queryable[S]]]( - c.reifyTree( c.runtimeUniverse, EmptyTree, c.typeCheck( + c.reifyTree( mkRuntimeUniverseRef, EmptyTree, c.typeCheck( Utils[c.type](c).removeDoubleReify( Apply(Select(c.prefix.tree, newTermName( name )), List( projection.tree )) ).asInstanceOf[Tree] diff --git a/test/files/run/macro-reify-nested-b/Impls_Macros_1.scala b/test/files/run/macro-reify-nested-b/Impls_Macros_1.scala index ae2def2d3e..b4351c2c53 100644 --- a/test/files/run/macro-reify-nested-b/Impls_Macros_1.scala +++ b/test/files/run/macro-reify-nested-b/Impls_Macros_1.scala @@ -23,9 +23,10 @@ case class Utils[C <: Context]( c:C ) { object QueryableMacros{ def _helper[C <: Context,S:c.WeakTypeTag]( c:C )( name:String, projection:c.Expr[_] ) = { import c.universe._ + import treeBuild._ val element_type = implicitly[c.WeakTypeTag[S]].tpe val foo = c.Expr[ru.Expr[Queryable[S]]]( - c.reifyTree( c.runtimeUniverse, EmptyTree, c.typeCheck( + c.reifyTree( mkRuntimeUniverseRef, EmptyTree, c.typeCheck( Utils[c.type](c).removeDoubleReify( Apply(Select(c.prefix.tree, newTermName( name )), List( projection.tree )) ).asInstanceOf[Tree] diff --git a/test/files/run/macro-reify-unreify/Macros_1.scala b/test/files/run/macro-reify-unreify/Macros_1.scala index 620a929210..9f04c13014 100644 --- a/test/files/run/macro-reify-unreify/Macros_1.scala +++ b/test/files/run/macro-reify-unreify/Macros_1.scala @@ -6,9 +6,10 @@ object Macros { object Impls { def foo(c: Ctx)(s: c.Expr[String]) = { import c.universe._ + import treeBuild._ - val world = c.reifyTree(c.runtimeUniverse, EmptyTree, s.tree) - val greeting = c.reifyTree(c.runtimeUniverse, EmptyTree, c.typeCheck(Apply(Select(Literal(Constant("hello ")), newTermName("$plus")), List(c.unreifyTree(world))))) + val world = c.reifyTree(mkRuntimeUniverseRef, EmptyTree, s.tree) + val greeting = c.reifyTree(mkRuntimeUniverseRef, EmptyTree, c.typeCheck(Apply(Select(Literal(Constant("hello ")), newTermName("$plus")), List(c.unreifyTree(world))))) val typedGreeting = c.Expr[String](greeting) c.universe.reify { |