@@ -202,7 +202,7 @@ abstract class ExplicitOuter extends InfoTransform
202
202
* values for outer parameters of constructors.
203
203
* The class provides methods for referencing via outer.
204
204
*/
205
- abstract class OuterPathTransformer (unit : CompilationUnit ) extends TypingTransformer (unit) with UnderConstructionTransformer {
205
+ abstract class OuterPathTransformer (unit : CompilationUnit ) extends TypingTransformer (unit) {
206
206
/** The directly enclosing outer parameter, if we are in a constructor */
207
207
protected var outerParam : Symbol = NoSymbol
208
208
@@ -267,6 +267,13 @@ abstract class ExplicitOuter extends InfoTransform
267
267
else outerPath(outerSelect(base), from.outerClass, to)
268
268
}
269
269
270
+
271
+ /** The stack of class symbols in which a call to this() or to the super
272
+ * constructor, or early definition is active
273
+ */
274
+ protected def isUnderConstruction (clazz : Symbol ) = selfOrSuperCalls contains clazz
275
+ protected val selfOrSuperCalls = collection.mutable.Stack [Symbol ]()
276
+
270
277
override def transform (tree : Tree ): Tree = {
271
278
def sym = tree.symbol
272
279
val savedOuterParam = outerParam
@@ -279,7 +286,13 @@ abstract class ExplicitOuter extends InfoTransform
279
286
assert(outerParam.name startsWith nme.OUTER , outerParam.name)
280
287
case _ =>
281
288
}
282
- super .transform(tree)
289
+ if ((treeInfo isSelfOrSuperConstrCall tree) || (treeInfo isEarlyDef tree)) {
290
+ selfOrSuperCalls push currentOwner.owner
291
+ val transformed = super .transform(tree)
292
+ selfOrSuperCalls.pop()
293
+ transformed
294
+ } else
295
+ super .transform(tree)
283
296
}
284
297
finally outerParam = savedOuterParam
285
298
}
0 commit comments