diff options
author | Martin Odersky <odersky@gmail.com> | 2014-02-13 14:50:04 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2014-02-13 14:50:04 +0100 |
commit | c4bed34b009ffc54b1eac10ee75fba27040f1533 (patch) | |
tree | 956b51a53a1b0c5358cca63bf3f4ee47abb59c38 /src/dotty/tools/dotc/core/Types.scala | |
parent | 80acc2d331cf8359c00d9a15c8cc10d537be503a (diff) | |
download | dotty-c4bed34b009ffc54b1eac10ee75fba27040f1533.tar.gz dotty-c4bed34b009ffc54b1eac10ee75fba27040f1533.tar.bz2 dotty-c4bed34b009ffc54b1eac10ee75fba27040f1533.zip |
Two performance optimizations
1) Split out wildApprox into separate function
2) Be more careful not to follow static prefix chains where not needed
Diffstat (limited to 'src/dotty/tools/dotc/core/Types.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/Types.scala | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala index b99162383..bacbe4f9d 100644 --- a/src/dotty/tools/dotc/core/Types.scala +++ b/src/dotty/tools/dotc/core/Types.scala @@ -2080,6 +2080,8 @@ object Types { abstract class TypeMap(implicit ctx: Context) extends (Type => Type) { thisMap => + protected def stopAtStatic = true + def apply(tp: Type): Type protected var variance = 1 @@ -2087,7 +2089,8 @@ object Types { /** Map this function over given type */ def mapOver(tp: Type): Type = tp match { case tp: NamedType => - tp.derivedSelect(this(tp.prefix)) + if (stopAtStatic && tp.symbol.isStatic) tp + else tp.derivedSelect(this(tp.prefix)) case _: ThisType | _: BoundType @@ -2173,6 +2176,7 @@ object Types { tp.derivedClassInfo(this(tp.prefix)) def andThen(f: Type => Type): TypeMap = new TypeMap { + override def stopAtStatic = thisMap.stopAtStatic def apply(tp: Type) = f(thisMap(tp)) } } @@ -2191,6 +2195,7 @@ object Types { } object IdentityTypeMap extends TypeMap()(NoContext) { + override def stopAtStatic = true def apply(tp: Type) = tp } |