diff options
author | Martin Odersky <odersky@gmail.com> | 2014-10-21 16:38:27 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2014-10-26 16:24:01 +0100 |
commit | 04001befb1a7f08da0c38166eed61322104adbaf (patch) | |
tree | 1eb21c86a91aaea1c9a5be0583072df4da139ecb /src/dotty/tools/dotc/transform/ExplicitOuter.scala | |
parent | e3b0fa2ede56393165759eecd7bc916d24835ee1 (diff) | |
download | dotty-04001befb1a7f08da0c38166eed61322104adbaf.tar.gz dotty-04001befb1a7f08da0c38166eed61322104adbaf.tar.bz2 dotty-04001befb1a7f08da0c38166eed61322104adbaf.zip |
Two fixes to avoid scanning package contents
typeParams and outerAccessor both potentially scan all declarations of a class.
The fixes make sure this is never done for packages.
Diffstat (limited to 'src/dotty/tools/dotc/transform/ExplicitOuter.scala')
-rw-r--r-- | src/dotty/tools/dotc/transform/ExplicitOuter.scala | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/transform/ExplicitOuter.scala b/src/dotty/tools/dotc/transform/ExplicitOuter.scala index 179f8d712..d056d7e35 100644 --- a/src/dotty/tools/dotc/transform/ExplicitOuter.scala +++ b/src/dotty/tools/dotc/transform/ExplicitOuter.scala @@ -179,7 +179,8 @@ object ExplicitOuter { * definitions in the class to find the one with the OuterAccessor flag. */ def outerAccessor(cls: ClassSymbol)(implicit ctx: Context): Symbol = - cls.info.member(outerAccName(cls)).suchThat(_ is OuterAccessor).symbol orElse + if (cls.isStatic) NoSymbol // fast return to avoid scanning package decls + else cls.info.member(outerAccName(cls)).suchThat(_ is OuterAccessor).symbol orElse cls.info.decls.find(_ is OuterAccessor).getOrElse(NoSymbol) /** Class has an outer accessor. Can be called only after phase ExplicitOuter. */ |