aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/SymDenotations.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-02-21 11:40:48 +0100
committerMartin Odersky <odersky@gmail.com>2014-02-21 18:42:50 +0100
commit56ffb721b612d7efdf1056335ffe46951217aa06 (patch)
treeecfa74f1ca91c9bf7245f45adca0d169013e916b /src/dotty/tools/dotc/core/SymDenotations.scala
parentd8f1fa55af2d832c07d89abaf9ecffc44c6572f8 (diff)
downloaddotty-56ffb721b612d7efdf1056335ffe46951217aa06.tar.gz
dotty-56ffb721b612d7efdf1056335ffe46951217aa06.tar.bz2
dotty-56ffb721b612d7efdf1056335ffe46951217aa06.zip
Peformance improvement: Better basetype caching
Now first checks in cache before going into special case for static classes (derivesFrom on types is not free!)
Diffstat (limited to 'src/dotty/tools/dotc/core/SymDenotations.scala')
-rw-r--r--src/dotty/tools/dotc/core/SymDenotations.scala8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/dotty/tools/dotc/core/SymDenotations.scala b/src/dotty/tools/dotc/core/SymDenotations.scala
index b377817f9..70b928a42 100644
--- a/src/dotty/tools/dotc/core/SymDenotations.scala
+++ b/src/dotty/tools/dotc/core/SymDenotations.scala
@@ -1065,7 +1065,9 @@ object SymDenotations {
def computeBaseTypeOf(tp: Type): Type = {
Stats.record("computeBaseTypeOf")
- tp match {
+ if (symbol.isStatic && tp.derivesFrom(symbol))
+ symbol.typeRef
+ else tp match {
case tp: TypeRef =>
val subcls = tp.symbol
if (subcls eq symbol)
@@ -1089,9 +1091,7 @@ object SymDenotations {
}
/*>|>*/ ctx.debugTraceIndented(s"$tp.baseType($this)") /*<|<*/ {
- if (symbol.isStatic && tp.derivesFrom(symbol))
- symbol.typeRef
- else tp match {
+ tp match {
case tp: CachedType =>
if (baseTypeValid != ctx.runId) {
baseTypeCache = new java.util.HashMap[CachedType, Type]