diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2012-04-25 19:37:26 +0300 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2012-04-25 20:32:55 +0300 |
commit | 79dfed0baabd14394ba078b62c7418ae0e738603 (patch) | |
tree | f58168c14cc93f4be4cfe924fdb254750e4e9ff5 /src | |
parent | 5cf9499731255078de62c8f3704fa596b564bf0e (diff) | |
download | scala-79dfed0baabd14394ba078b62c7418ae0e738603.tar.gz scala-79dfed0baabd14394ba078b62c7418ae0e738603.tar.bz2 scala-79dfed0baabd14394ba078b62c7418ae0e738603.zip |
removes Expr <-> Tree implicits
Diffstat (limited to 'src')
-rw-r--r-- | src/library/scala/reflect/api/Exprs.scala | 34 | ||||
-rw-r--r-- | src/library/scala/reflect/api/Trees.scala | 28 | ||||
-rwxr-xr-x | src/library/scala/reflect/api/Universe.scala | 3 | ||||
-rw-r--r-- | src/library/scala/reflect/makro/Context.scala | 4 |
4 files changed, 4 insertions, 65 deletions
diff --git a/src/library/scala/reflect/api/Exprs.scala b/src/library/scala/reflect/api/Exprs.scala index ff89a1cd48..b8db64422e 100644 --- a/src/library/scala/reflect/api/Exprs.scala +++ b/src/library/scala/reflect/api/Exprs.scala @@ -16,36 +16,4 @@ trait Exprs { self: Universe => lazy val value: T = eval override def toString = "Expr["+tpe+"]("+tree+")" } - - // [Eugene] had to move this to the companion of Tree to make stuff compile. weirdo! -// object Expr { -// // would be great if in future this generated an Expr[Magic] -// // where Magic is a magic untyped type that propagates through the entire quasiquote -// // and turns off typechecking whenever it's involved -// // that'd allow us to splice trees into quasiquotes and still have these qqs to be partially typechecked -// // see some exploration of these ideas here: https://github.com/xeno-by/alphakeplerdemo -// implicit def tree2expr(tree: Tree): Expr[Nothing] = Expr[Nothing](tree) -// implicit def expr2tree(expr: Expr[_]): Tree = expr.tree -// -// // [Eugene] good idea? -// implicit def trees2exprs(trees: List[Tree]): List[Expr[Nothing]] = trees map tree2expr -// implicit def exprs2trees(exprs: List[Expr[_]]): List[Tree] = exprs map expr2tree -// } - - // [Eugene] even weirder - implicits didn't feel at home in Trees :( - - // would be great if in future this generated an Expr[Magic] - // where Magic is a magic untyped type that propagates through the entire quasiquote - // and turns off typechecking whenever it's involved - // that'd allow us to splice trees into quasiquotes and still have these qqs to be partially typechecked - // see some exploration of these ideas here: https://github.com/xeno-by/alphakeplerdemo - // [Martin] I have some doubts whether it's god to have implicit conversions. - implicit def tree2expr(tree: Tree): Expr[Nothing] = Expr[Nothing](tree)(TypeTag.Nothing) - implicit def expr2tree(expr: Expr[_]): Tree = expr.tree - - // [Eugene] good idea? - // [Martin] probably not. - implicit def trees2exprs(trees: List[Tree]): List[Expr[Nothing]] = trees map tree2expr - implicit def exprs2trees(exprs: List[Expr[_]]): List[Tree] = exprs map expr2tree -} - +}
\ No newline at end of file diff --git a/src/library/scala/reflect/api/Trees.scala b/src/library/scala/reflect/api/Trees.scala index b70ca7e0fd..9f8906a8cd 100644 --- a/src/library/scala/reflect/api/Trees.scala +++ b/src/library/scala/reflect/api/Trees.scala @@ -278,34 +278,6 @@ trait Trees { self: Universe => override def equals(that: Any) = this eq that.asInstanceOf[AnyRef] } - // [Eugene] uh-oh - // locker.comp: - // [mkdir] Created dir: C:\Projects\Kepler\build\locker\classes\compiler - // [scalacfork] Compiling 471 files to C:\Projects\Kepler\build\locker\classes\compiler - // [scalacfork] amb prefix: Importers.this.type#class Tree Importer.this.from.type#class Tree - // [scalacfork] amb prefix: Importers.this.type#class Tree Importer.this.from.type#class Tree - // [scalacfork] amb prefix: Importers.this.type#class Tree Importer.this.from.type#class Tree - // [scalacfork] amb prefix: Importers.this.type#class Tree Importer.this.from.type#class Tree - // [scalacfork] amb prefix: Importers.this.type#class Tree Importer.this.from.type#class Tree - // [scalacfork] amb prefix: Importers.this.type#class Tree Importer.this.from.type#class Tree - // [scalacfork] amb prefix: Importers.this.type#class Tree Importer.this.from.type#class Tree - // [scalacfork] amb prefix: Importers.this.type#class Tree Importer.this.from.type#class Tree - // [scalacfork] amb prefix: Importers.this.type#class Tree Importer.this.from.type#class Tree - // [scalacfork] amb prefix: Importers.this.type#class Tree Importer.this.from.type#class Tree -// object Tree { -// // would be great if in future this generated an Expr[Magic] -// // where Magic is a magic untyped type that propagates through the entire quasiquote -// // and turns off typechecking whenever it's involved -// // that'd allow us to splice trees into quasiquotes and still have these qqs to be partially typechecked -// // see some exploration of these ideas here: https://github.com/xeno-by/alphakeplerdemo -// implicit def tree2expr(tree: Tree): Expr[Nothing] = Expr[Nothing](tree) -// implicit def expr2tree(expr: Expr[_]): Tree = expr.tree -// -// // [Eugene] good idea? -// implicit def trees2exprs(trees: List[Tree]): List[Expr[Nothing]] = trees map tree2expr -// implicit def exprs2trees(exprs: List[Expr[_]]): List[Tree] = exprs map expr2tree -// } - /** A tree for a term. Not all terms are TermTrees; use isTerm * to reliably identify terms. */ diff --git a/src/library/scala/reflect/api/Universe.scala b/src/library/scala/reflect/api/Universe.scala index 2a7445c41c..9670780522 100755 --- a/src/library/scala/reflect/api/Universe.scala +++ b/src/library/scala/reflect/api/Universe.scala @@ -65,8 +65,7 @@ abstract class Universe extends Symbols object Universe { def reify[T](cc: scala.reflect.makro.Context{ type PrefixType = Universe })(expr: cc.Expr[T]): cc.Expr[cc.prefix.value.Expr[T]] = { - import cc.mirror._ import scala.reflect.makro.internal._ - cc.materializeExpr(cc.prefix, expr) + cc.Expr(cc.materializeExpr(cc.prefix.tree, expr.tree)) } } diff --git a/src/library/scala/reflect/makro/Context.scala b/src/library/scala/reflect/makro/Context.scala index 668d239087..b8fb0dcce5 100644 --- a/src/library/scala/reflect/makro/Context.scala +++ b/src/library/scala/reflect/makro/Context.scala @@ -36,9 +36,9 @@ object Context { import cc.mirror._ import scala.reflect.makro.internal._ // [Eugene] how do I typecheck this without undergoing this tiresome (and, in general, incorrect) procedure? - val prefix: Tree = Select(cc.prefix, newTermName("mirror")) + val prefix: Tree = Select(cc.prefix.tree, newTermName("mirror")) val prefixTpe = cc.typeCheck(TypeApply(Select(prefix, newTermName("asInstanceOf")), List(SingletonTypeTree(prefix)))).tpe prefix setType prefixTpe - cc.materializeExpr(prefix, expr) + cc.Expr(cc.materializeExpr(prefix, expr.tree)) } } |