Skip to content

Commit 864f5c4

Browse files
committed
Remove dead code in Constructors
The intoConstr method is never called with argument inSuperCall = true. So code dependent on it can be dropped.
1 parent 05a3c38 commit 864f5c4

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,10 @@ class Constructors extends MiniPhaseTransform with SymTransformer { thisTransfor
8080
// (2) If the parameter accessor reference was to an alias getter,
8181
// drop the () when replacing by the parameter.
8282
object intoConstr extends TreeMap {
83-
private var excluded: FlagSet = _
8483
override def transform(tree: Tree)(implicit ctx: Context): Tree = tree match {
8584
case Ident(_) | Select(This(_), _) =>
8685
var sym = tree.symbol
87-
if (sym is (ParamAccessor, butNot = excluded)) sym = sym.subst(accessors, paramSyms)
86+
if (sym is (ParamAccessor, butNot = Mutable)) sym = sym.subst(accessors, paramSyms)
8887
if (sym.owner.isConstructor) ref(sym).withPos(tree.pos) else tree
8988
case Apply(fn, Nil) =>
9089
val fn1 = transform(fn)
@@ -95,8 +94,7 @@ class Constructors extends MiniPhaseTransform with SymTransformer { thisTransfor
9594
if (noDirectRefsFrom(tree)) tree else super.transform(tree)
9695
}
9796

98-
def apply(tree: Tree, prevOwner: Symbol, inSuperCall: Boolean = false)(implicit ctx: Context): Tree = {
99-
this.excluded = if (inSuperCall) EmptyFlags else Mutable
97+
def apply(tree: Tree, prevOwner: Symbol)(implicit ctx: Context): Tree = {
10098
transform(tree).changeOwnerAfter(prevOwner, constr.symbol, thisTransform)
10199
}
102100
}

0 commit comments

Comments
 (0)