@@ -150,23 +150,26 @@ class Constructors extends MiniPhase with IdentityDenotTransformer { thisPhase =
150
150
// drop the () when replacing by the parameter.
151
151
object intoConstr extends TreeMap {
152
152
private var isSuperCall = false
153
- override def transform (tree : Tree )(using Context ): Tree = tree match {
154
- case Ident (_) | Select (This (_), _) =>
155
- var sym = tree.symbol
156
- if sym.is(ParamAccessor ) && (! sym.is(Mutable ) || isSuperCall)
157
- // Variables need to go through the getter since they might have been updated,
158
- // except if we are in a super call, since then the virtual getter call would
159
- // be illegal.
160
- then
161
- sym = sym.subst(accessors, paramSyms)
162
- if (sym.maybeOwner.isConstructor) ref(sym).withSpan(tree.span) else tree
163
- case Apply (fn, Nil ) =>
164
- val fn1 = transform(fn)
165
- if ((fn1 ne fn) && fn1.symbol.is(Param ) && fn1.symbol.owner.isPrimaryConstructor)
166
- fn1 // in this case, fn1.symbol was an alias for a parameter in a superclass
167
- else cpy.Apply (tree)(fn1, Nil )
168
- case _ =>
169
- if (noDirectRefsFrom(tree)) tree else super .transform(tree)
153
+ override def transform (tree : Tree )(using Context ): Tree =
154
+ inContext(transformCtx(tree)) {
155
+ tree match {
156
+ case Ident (_) | Select (This (_), _) =>
157
+ var sym = tree.symbol
158
+ if sym.is(ParamAccessor ) && (! sym.is(Mutable ) || isSuperCall)
159
+ // Variables need to go through the getter since they might have been updated,
160
+ // except if we are in a super call, since then the virtual getter call would
161
+ // be illegal.
162
+ then
163
+ sym = sym.subst(accessors, paramSyms)
164
+ if (sym.maybeOwner.isConstructor) ref(sym).withSpan(tree.span) else tree
165
+ case Apply (fn, Nil ) =>
166
+ val fn1 = transform(fn)
167
+ if ((fn1 ne fn) && fn1.symbol.is(Param ) && fn1.symbol.owner.isPrimaryConstructor)
168
+ fn1 // in this case, fn1.symbol was an alias for a parameter in a superclass
169
+ else cpy.Apply (tree)(fn1, Nil )
170
+ case _ =>
171
+ if (noDirectRefsFrom(tree)) tree else super .transform(tree)
172
+ }
170
173
}
171
174
172
175
def apply (tree : Tree , prevOwner : Symbol )(using Context ): Tree =
0 commit comments