File tree 1 file changed +6
-2
lines changed
src/dotty/tools/dotc/transform 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
36
36
37
37
private var needsCompanionPredicate : ClassSymbol => Boolean = null
38
38
39
+ private var addCompanionPhases : List [NeedsCompanions ] = _
40
+
41
+ def needsCompanion (cls : ClassSymbol )(implicit ctx : Context ) =
42
+ addCompanionPhases.exists(_.isCompanionNeeded(cls))
43
+
39
44
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 })
42
46
this
43
47
}
44
48
You can’t perform that action at this time.
0 commit comments