File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
src/dotty/tools/dotc/transform Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -36,9 +36,13 @@ class FirstTransform extends MiniPhaseTransform with IdentityDenotTransformer wi
3636
3737 private var needsCompanionPredicate : ClassSymbol => Boolean = null
3838
39+ private var addCompanionPhases : List [NeedsCompanions ] = _
40+
41+ def needsCompanion (cls : ClassSymbol )(implicit ctx : Context ) =
42+ addCompanionPhases.exists(_.isCompanionNeeded(cls))
43+
3944 override def prepareForUnit (tree : tpd.Tree )(implicit ctx : Context ): TreeTransform = {
40- needsCompanionPredicate = ctx.phasePlan.flatMap(_.filter(x => x.isInstanceOf [NeedsCompanions ])).
41- foldLeft((x : ClassSymbol ) => false )((pred, phase) => x => pred(x) || phase.asInstanceOf [NeedsCompanions ].isCompanionNeeded(x))
45+ addCompanionPhases = ctx.phasePlan.flatMap(_ collect { case p : NeedsCompanions => p })
4246 this
4347 }
4448
You can’t perform that action at this time.
0 commit comments