summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/transform/CleanUp.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2013-09-13 14:06:00 -0700
committerPaul Phillips <paulp@improving.org>2013-09-13 15:03:13 -0700
commit330ead53be9569f0069be5f6ab62d82cd7c8367f (patch)
treee019464ca80c0f91d1846b4ff045ad68a0456307 /src/compiler/scala/tools/nsc/transform/CleanUp.scala
parent55c6fd40702244e1835581a67103efdd2fd93dd4 (diff)
downloadscala-330ead53be9569f0069be5f6ab62d82cd7c8367f.tar.gz
scala-330ead53be9569f0069be5f6ab62d82cd7c8367f.tar.bz2
scala-330ead53be9569f0069be5f6ab62d82cd7c8367f.zip
Reducing variation of tree creation methods.
TreeDSL has no future - it was always a temporary measure waiting for something like quasiquotes to come along. In this commit I cull as much of it as I can, especially the delicate matter of creating new DefDefs and ValDefs, which I completely turn over to the old style creators. I unified all the symbol-based DefDef and ValDef creators under a single method, since it was yet another place where ctrl-C and ctrl-V were being punched with glee. Was beaten to the punch on adding copyTypeDef to fill out the *Def creators. Eliminated as many redundant positioning calls as I could find. If you are creating a DefTree tree based on a symbol, it will always have an atPos(sym.pos) { ... } wrapped around it. You don't need another one. All of this is motivated by positions work: positions are assigned in so many places and in such an ad hoc fashion that it is impossible to bring consistency to that without first bringing some consistency to tree creation.
Diffstat (limited to 'src/compiler/scala/tools/nsc/transform/CleanUp.scala')
-rw-r--r--src/compiler/scala/tools/nsc/transform/CleanUp.scala10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/CleanUp.scala b/src/compiler/scala/tools/nsc/transform/CleanUp.scala
index b16ba91916..0135190256 100644
--- a/src/compiler/scala/tools/nsc/transform/CleanUp.scala
+++ b/src/compiler/scala/tools/nsc/transform/CleanUp.scala
@@ -94,7 +94,7 @@ abstract class CleanUp extends Transform with ast.TreeDSL {
if (!isFinal)
varSym.addAnnotation(VolatileAttr)
- val varDef = typedPos( VAL(varSym) === forInit )
+ val varDef = typedPos(ValDef(varSym, forInit))
newStaticMembers append transform(varDef)
val varInit = typedPos( REF(varSym) === forInit )
@@ -155,13 +155,13 @@ abstract class CleanUp extends Transform with ast.TreeDSL {
val methodSym = reflMethodSym.newVariable(mkTerm("method"), ad.pos) setInfo MethodClass.tpe
BLOCK(
- VAL(methodCache) === getPolyCache,
+ ValDef(methodCache, getPolyCache),
IF (REF(methodCache) OBJ_EQ NULL) THEN BLOCK(
REF(methodCache) === NEW(TypeTree(EmptyMethodCacheClass.tpe)),
REF(reflPolyCacheSym) === gen.mkSoftRef(REF(methodCache))
) ENDIF,
- VAL(methodSym) === (REF(methodCache) DOT methodCache_find)(REF(forReceiverSym)),
+ ValDef(methodSym, (REF(methodCache) DOT methodCache_find)(REF(forReceiverSym))),
IF (REF(methodSym) OBJ_NE NULL) .
THEN (Return(REF(methodSym)))
ELSE {
@@ -372,7 +372,7 @@ abstract class CleanUp extends Transform with ast.TreeDSL {
qual = REF(sym)
BLOCK(
- VAL(sym) === qual0,
+ ValDef(sym, qual0),
callAsReflective(mparams map (_.tpe), resType)
)
}
@@ -543,7 +543,7 @@ abstract class CleanUp extends Transform with ast.TreeDSL {
)
// create field definition and initialization
- val stfieldDef = theTyper.typedPos(pos)(VAL(stfieldSym) === rhs)
+ val stfieldDef = theTyper.typedPos(pos)(ValDef(stfieldSym, rhs))
val stfieldInit = theTyper.typedPos(pos)(REF(stfieldSym) === rhs)
// add field definition to new defs