summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-02-23 00:36:18 -0800
committerPaul Phillips <paulp@improving.org>2012-02-23 02:27:05 -0800
commitd5006b118f6ad1bf10ed35491cd0bda05fc88972 (patch)
treed76b018d1de05407467af068e68d8b74d73fe977 /src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala
parent4a984f82d5bfca05123c53bd385d0299818f8a75 (diff)
downloadscala-d5006b118f6ad1bf10ed35491cd0bda05fc88972.tar.gz
scala-d5006b118f6ad1bf10ed35491cd0bda05fc88972.tar.bz2
scala-d5006b118f6ad1bf10ed35491cd0bda05fc88972.zip
Methods to derive ValDefs and Templates.
It's a lot like the last one. I also found trees being duplicated before being sent to the tree copier. Looks like xerox has gotten a mole in here. Trust no one.
Diffstat (limited to 'src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala')
-rw-r--r--src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala
index 1e1c9efebb..9f40c10db9 100644
--- a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala
+++ b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala
@@ -1480,21 +1480,22 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers {
localTyper.typed(deriveDefDef(tree)(rhs => rhs))
}
- case ValDef(mods, name, tpt, rhs) if symbol.hasFlag(SPECIALIZED) && !symbol.isParamAccessor =>
+ case ValDef(_, _, _, _) if symbol.hasFlag(SPECIALIZED) && !symbol.isParamAccessor =>
assert(body.isDefinedAt(symbol.alias), body)
- val tree1 = treeCopy.ValDef(tree, mods, name, tpt, body(symbol.alias).duplicate)
+ val tree1 = deriveValDef(tree)(_ => body(symbol.alias).duplicate)
debuglog("now typing: " + tree1 + " in " + tree.symbol.owner.fullName)
+
val d = new Duplicator
- val ValDef(mods1, name1, tpt1, rhs1) = d.retyped(
+ val newValDef = d.retyped(
localTyper.context1.asInstanceOf[d.Context],
tree1,
symbol.alias.enclClass,
symbol.enclClass,
typeEnv(symbol.alias) ++ typeEnv(tree.symbol)
)
- val t = treeCopy.ValDef(tree1, mods1, name1, tpt1, transform(rhs1))
- log("valdef " + tree + " -> " + t)
- t
+ logResult("valdef " + tree + " -> ") {
+ deriveValDef(newValDef)(transform)
+ }
// val tree1 =
// treeCopy.ValDef(tree, mods, name, tpt,