Skip to content

Commit 5852560

Browse files
committed
Address review comments #774
1 parent 56b1951 commit 5852560

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/dotty/tools/dotc/transform/Constructors.scala

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,8 @@ class Constructors extends MiniPhaseTransform with SymTransformer { thisTransfor
4141
// 3. It is accessed on an object other than `this`
4242
// 4. It is a mutable parameter accessor
4343
// 5. It is has a wildcard initializer `_`
44-
private var retainedPrivateVals = mutable.Set[Symbol]()
45-
private var seenPrivateVals = mutable.Set[Symbol]()
46-
private var insideConstructor = false
44+
private val retainedPrivateVals = mutable.Set[Symbol]()
45+
private val seenPrivateVals = mutable.Set[Symbol]()
4746

4847
private def markUsedPrivateSymbols(tree: RefTree)(implicit ctx: Context): Unit = {
4948

@@ -63,7 +62,6 @@ class Constructors extends MiniPhaseTransform with SymTransformer { thisTransfor
6362
if (inConstructor && (sym.is(ParamAccessor) || seenPrivateVals.contains(sym))) {
6463
// used inside constructor, accessed on this,
6564
// could use constructor argument instead, no need to retain field
66-
println("hoha")
6765
}
6866
else retain
6967
case _ => retain
@@ -81,7 +79,6 @@ class Constructors extends MiniPhaseTransform with SymTransformer { thisTransfor
8179
tree
8280
}
8381

84-
8582
override def transformValDef(tree: tpd.ValDef)(implicit ctx: Context, info: TransformerInfo): tpd.Tree = {
8683
if (mightBeDropped(tree.symbol))
8784
(if (isWildcardStarArg(tree.rhs)) retainedPrivateVals else seenPrivateVals) += tree.symbol
@@ -254,8 +251,7 @@ class Constructors extends MiniPhaseTransform with SymTransformer { thisTransfor
254251
info = clsInfo.derivedClassInfo(
255252
decls = clsInfo.decls.filteredScope(!dropped.contains(_))))
256253

257-
// TODO: this happens to work only because Constructors is the last phase in group
258-
}
254+
// TODO: this happens to work only because Constructors is the last phase in groupp }
259255

260256
val (superCalls, followConstrStats) = constrStats.toList match {
261257
case (sc: Apply) :: rest if sc.symbol.isConstructor => (sc :: Nil, rest)

0 commit comments

Comments
 (0)