8000 Revert "SI-3832 Extract tracking of under-construction classes to a m… · scala/scala@27e4140 · GitHub
[go: up one dir, main page]

Skip to content

Commit 27e4140

Browse files
committed
Revert "SI-3832 Extract tracking of under-construction classes to a mixin"
This reverts commit c2dc346.
1 parent a2b940c commit 27e4140

File tree

2 files changed

+15
-21
lines changed

2 files changed

+15
-21
lines changed

src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ abstract class ExplicitOuter extends InfoTransform
202202
* values for outer parameters of constructors.
203203
* The class provides methods for referencing via outer.
204204
*/
205-
abstract class OuterPathTransformer(unit: CompilationUnit) extends TypingTransformer(unit) with UnderConstructionTransformer {
205+
abstract class OuterPathTransformer(unit: CompilationUnit) extends TypingTransformer(unit) {
206206
/** The directly enclosing outer parameter, if we are in a constructor */
207207
protected var outerParam: Symbol = NoSymbol
208208

@@ -267,6 +267,13 @@ abstract class ExplicitOuter extends InfoTransform
267267
else outerPath(outerSelect(base), from.outerClass, to)
268268
}
269269

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+
270277
override def transform(tree: Tree): Tree = {
271278
def sym = tree.symbol
272279
val savedOuterParam = outerParam
@@ -279,7 +286,13 @@ abstract class ExplicitOuter extends InfoTransform
279286
assert(outerParam.name startsWith nme.OUTER, outerParam.name)
280287
case _ =>
281288
}
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)
283296
}
284297
finally outerParam = savedOuterParam
285298
}

src/reflect/scala/reflect/internal/Trees.scala

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1769,25 +1769,6 @@ trait Trees extends api.Trees {
17691769
}
17701770
}
17711771

1772-
/** Tracks the classes currently under construction during a transform */
1773-
trait UnderConstructionTransformer extends Transformer {
1774-
import collection.mutable
1775-
1776-
protected def isUnderConstruction(clazz: Symbol) = selfOrSuperCalls contains clazz
1777-
1778-
/** The stack of class symbols in which a call to this() or to the super
1779-
* constructor, or early definition is active */
1780-
private val selfOrSuperCalls = mutable.Stack[Symbol]()
1781-
1782-
abstract override def transform(tree: Tree) = {
1783-
if ((treeInfo isSelfOrSuperConstrCall tree) || (treeInfo isEarlyDef tree)) {
1784-
selfOrSuperCalls push currentOwner.owner
1785-
try super.transform(tree)
1786-
finally selfOrSuperCalls.pop()
1787-
} else super.transform(tree)
1788-
}
1789-
}
1790-
17911772
def duplicateAndKeepPositions(tree: Tree) = new Duplicator(focusPositions = false) transform tree
17921773

17931774
// this is necessary to avoid crashes like https://github.com/scalamacros/paradise/issues/1

0 commit comments

Comments
 (0)
0