Skip to content
Browse files

improved naming of variables in constructors phase

  • Loading branch information...
1 parent b4fbb7b commit fc8387f6b754cab7f7947d1ea2d985d6a3d183a2 @magarciaEPFL magarciaEPFL committed Apr 25, 2013
Showing with 10 additions and 17 deletions.
  1. +10 −17 src/compiler/scala/tools/nsc/transform/Constructors.scala
View
27 src/compiler/scala/tools/nsc/transform/Constructors.scala
@@ -418,12 +418,6 @@ abstract class Constructors extends Transform with ast.TreeDSL {
} else stats
}
- // def isInitDef(stat: Tree) = stat match {
- // case dd: DefDef => dd.symbol == delayedInitMethod
- // case _ => false
- // }
-
-
/*
* Translation scheme for DelayedInit
* ----------------------------------
@@ -486,7 +480,7 @@ abstract class Constructors extends Transform with ast.TreeDSL {
/* @see overview at `delayedEndpointDef()` of the translation scheme for DelayedInit */
def delayedInitClosure(delayedEndPointSym: MethodSymbol): ClassDef = {
- val dicl = localTyper.typed {
+ val satelliteClass = localTyper.typed {
atPos(impl.pos) {
val closureClass = clazz.newClass(nme.delayedInitArg.toTypeName, impl.pos, SYNTHETIC | FINAL)
val closureParents = List(AbstractFunctionClass(0).tpe)
@@ -529,7 +523,7 @@ abstract class Constructors extends Transform with ast.TreeDSL {
}
}
- dicl.asInstanceOf[ClassDef]
+ satelliteClass.asInstanceOf[ClassDef]
}
/* @see overview at `delayedEndpointDef()` of the translation scheme for DelayedInit */
@@ -555,19 +549,18 @@ abstract class Constructors extends Transform with ast.TreeDSL {
* See test case files/run/bug4680.scala, the output of which is wrong in many
* particulars.
*/
- val needsDelayedInit =
- isDelayedInitSubclass /*&& !(defBuf exists isInitDef)*/ && remainingConstrStats.nonEmpty
+ val needsDelayedInit = (isDelayedInitSubclass && remainingConstrStats.nonEmpty)
if (needsDelayedInit) {
- val dlydEpDef: DefDef = delayedEndpointDef(remainingConstrStats)
- defBuf += dlydEpDef
- val dicl = {
+ val delayedHook: DefDef = delayedEndpointDef(remainingConstrStats)
+ defBuf += delayedHook
+ val hookCallerClass = {
// transform to make the closure-class' default constructor assign the the outer instance to its param-accessor field.
- val diclx = new ConstructorTransformer(unit)
- diclx transform delayedInitClosure(dlydEpDef.symbol.asInstanceOf[MethodSymbol])
+ val drillDown = new ConstructorTransformer(unit)
+ drillDown transform delayedInitClosure(delayedHook.symbol.asInstanceOf[MethodSymbol])
}
- defBuf += dicl
- remainingConstrStats = delayedInitCall(dicl) :: Nil
+ defBuf += hookCallerClass
+ remainingConstrStats = delayedInitCall(hookCallerClass) :: Nil
}
// Assemble final constructor

0 comments on commit fc8387f

Please sign in to comment.
Something went wrong with that request. Please try again.