diff options
author | Burak Emir <emir@epfl.ch> | 2006-06-17 15:39:23 +0000 |
---|---|---|
committer | Burak Emir <emir@epfl.ch> | 2006-06-17 15:39:23 +0000 |
commit | 28c125d3b9466148db9e593cf965f58c24f9b43c (patch) | |
tree | 72d4c4701b1da84a82e1671778bd7ebd90abeea4 | |
parent | b142c4376d0719f67f1c4a609564a89936474d10 (diff) | |
download | scala-28c125d3b9466148db9e593cf965f58c24f9b43c.tar.gz scala-28c125d3b9466148db9e593cf965f58c24f9b43c.tar.bz2 scala-28c125d3b9466148db9e593cf965f58c24f9b43c.zip |
added code for lifting valdef
-rw-r--r-- | src/compiler/scala/tools/nsc/transform/LiftCode.scala | 8 | ||||
-rw-r--r-- | src/library/scala/reflect/Tree.scala | 1 |
2 files changed, 9 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/LiftCode.scala b/src/compiler/scala/tools/nsc/transform/LiftCode.scala index 9dd92af3af..03e964df88 100644 --- a/src/compiler/scala/tools/nsc/transform/LiftCode.scala +++ b/src/compiler/scala/tools/nsc/transform/LiftCode.scala @@ -103,6 +103,13 @@ abstract class LiftCode extends Transform { env.addTarget(name.toString(), sym) val res = reflect.Target(sym, reify(body)) res + + case vd @ ValDef(mods, name, tpt, rhs) => + val rtpe = reify(vd.tpe) // will return null, currently?! + val sym = reflect.LocalValue(currentOwner, name.toString(), rtpe) + val rhs_ = reify(rhs) + reflect.ValDef(sym, rhs_) + case _ => throw new TypeError("cannot reify tree: " + tree) } @@ -173,6 +180,7 @@ abstract class LiftCode extends Transform { case reflect.MethodType(_, _) => if (value.isInstanceOf[reflect.ImplicitMethodType]) "scala.reflect.ImplicitMethodType" else "scala.reflect.MethodType" case reflect.PolyType(_, _, _) => "scala.reflect.PolyType" + case x:reflect.ValDef => "scala.reflect.ValDef" // bq case _ => "" } diff --git a/src/library/scala/reflect/Tree.scala b/src/library/scala/reflect/Tree.scala index dd46e42873..9cf848be8a 100644 --- a/src/library/scala/reflect/Tree.scala +++ b/src/library/scala/reflect/Tree.scala @@ -27,3 +27,4 @@ case class If(condition: Tree, trueCase: Tree, falseCase: Tree) extends Tree; case class Assign(destination: Tree, source: Tree) extends Tree; case class Target(sym: LabelSymbol, body: Tree) extends Tree; case class Goto(target: LabelSymbol) extends Tree; +case class ValDef(sym: Symbol, rhs: Tree) extends Tree; |