diff options
author | Martin Odersky <odersky@gmail.com> | 2016-03-03 10:37:40 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2016-03-03 10:37:40 +0100 |
commit | 21a53daa8d03f04d165b4ea1edbe46fecee36ea0 (patch) | |
tree | 24a06702ceb878bfef9158dbc1e9a8670c7f936d | |
parent | 0e21000f5527461b68a382346712e5f52fb3beec (diff) | |
download | dotty-21a53daa8d03f04d165b4ea1edbe46fecee36ea0.tar.gz dotty-21a53daa8d03f04d165b4ea1edbe46fecee36ea0.tar.bz2 dotty-21a53daa8d03f04d165b4ea1edbe46fecee36ea0.zip |
Speed up LazyVals isCompanion needed
Brings time to compile stdlib down from 185s to 44s.
-rw-r--r-- | src/dotty/tools/dotc/core/Types.scala | 2 | ||||
-rw-r--r-- | src/dotty/tools/dotc/transform/LazyVals.scala | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala index da3b76c57..7accd384a 100644 --- a/src/dotty/tools/dotc/core/Types.scala +++ b/src/dotty/tools/dotc/core/Types.scala @@ -609,7 +609,7 @@ object Types { (name, buf) => buf ++= member(name).altsWith(x => !x.is(Method))) } - /** The set of members of this type having at least one of `requiredFlags` but none of `excludedFlags` set */ + /** The set of members of this type having at least one of `requiredFlags` but none of `excludedFlags` set */ final def membersBasedOnFlags(requiredFlags: FlagSet, excludedFlags: FlagSet)(implicit ctx: Context): Seq[SingleDenotation] = track("implicitMembers") { memberDenots(takeAllFilter, (name, buf) => buf ++= member(name).altsWith(x => x.is(requiredFlags, butNot = excludedFlags))) diff --git a/src/dotty/tools/dotc/transform/LazyVals.scala b/src/dotty/tools/dotc/transform/LazyVals.scala index 2aece0663..0d0ba191e 100644 --- a/src/dotty/tools/dotc/transform/LazyVals.scala +++ b/src/dotty/tools/dotc/transform/LazyVals.scala @@ -48,7 +48,7 @@ class LazyVals extends MiniPhaseTransform with IdentityDenotTransformer with Nee override def runsAfter = Set(classOf[Mixin]) def isCompanionNeeded(cls: ClassSymbol)(implicit ctx: Context): Boolean = { - def hasLazyVal(x: ClassSymbol) = x.classInfo.membersBasedOnFlags(Flags.Lazy, excludedFlags = Flags.EmptyFlags).nonEmpty + def hasLazyVal(cls: ClassSymbol) = cls.info.decls.exists(_.is(Flags.Lazy)) hasLazyVal(cls) || cls.mixins.exists(hasLazyVal) } |