diff options
author | Lex Spoon <lex@lexspoon.org> | 2007-07-17 09:25:17 +0000 |
---|---|---|
committer | Lex Spoon <lex@lexspoon.org> | 2007-07-17 09:25:17 +0000 |
commit | a840917b32e1c0f25b846f48bd0f12088fe170b2 (patch) | |
tree | f0da1985f6c2321a861a5c6684992e7f0db936b2 /src/compiler/scala/tools/nsc/transform/LiftCode.scala | |
parent | 9f1345730a8e00a43ae628ae0c2f0a38b530579b (diff) | |
download | scala-a840917b32e1c0f25b846f48bd0f12088fe170b2.tar.gz scala-a840917b32e1c0f25b846f48bd0f12088fe170b2.tar.bz2 scala-a840917b32e1c0f25b846f48bd0f12088fe170b2.zip |
1.
just those that are precisely of the form "Code.lift(exp)".
2. The printout of a This(_) tree adds ".this" to the end.
3. This() is now only used for classes. For modules, the code is
rewritten as a Select() of the module.
Diffstat (limited to 'src/compiler/scala/tools/nsc/transform/LiftCode.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/transform/LiftCode.scala | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/LiftCode.scala b/src/compiler/scala/tools/nsc/transform/LiftCode.scala index 88a9350f0b..ccd35442fb 100644 --- a/src/compiler/scala/tools/nsc/transform/LiftCode.scala +++ b/src/compiler/scala/tools/nsc/transform/LiftCode.scala @@ -13,7 +13,8 @@ import scala.collection.immutable.ListMap import scala.collection.mutable.{HashMap, ListBuffer} import scala.tools.nsc.util.{FreshNameCreator, TreeSet} -/** This abstract class ... +/** Translate expressions of the form reflect.Code.lift(exp) + * to the lifted "reflect trees" representation of exp. * * @author Gilles Dubochet * @version 1.0 @@ -33,8 +34,8 @@ abstract class LiftCode extends Transform { class AddRefFields(unit: CompilationUnit) extends Transformer { override def transform(tree: Tree): Tree = tree match { - case Apply(TypeApply(Select(x@Ident(_), nme.lift_), _), List(tree)) - if x.symbol == CodeModule => + case Apply(lift, List(tree)) + if lift.symbol == Code_lift => typed(atPos(tree.pos)(codify(tree))) case _ => super.transform(tree) @@ -111,6 +112,11 @@ abstract class LiftCode extends Transform { } reflect.Function(vparams map (_.symbol) map env1, new Reifier(env1, currentOwner).reify(body)) + case tree@This(_) if tree.symbol.isModule => + // there is no reflect node for a module's this, so + // represent it as a selection of the module + reify(typed( + Select(This(tree.symbol.owner), tree.symbol.name))) case This(_) => reflect.This(reify(tree.symbol)) case Block(stats, expr) => |