From ffe9e2237956d167b51c9ab1e571a04163b525f7 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Thu, 14 Nov 2013 17:50:10 +0100 Subject: Some configuation parameters Caching, plus whether we want to match on signatures or types. --- src/dotty/tools/dotc/core/Denotations.scala | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'src/dotty/tools/dotc/core/Denotations.scala') diff --git a/src/dotty/tools/dotc/core/Denotations.scala b/src/dotty/tools/dotc/core/Denotations.scala index 4ab911160..60a4df9fa 100644 --- a/src/dotty/tools/dotc/core/Denotations.scala +++ b/src/dotty/tools/dotc/core/Denotations.scala @@ -12,6 +12,7 @@ import Types._, Periods._, Flags._, Transformers._, Decorators._ import printing.Texts._ import printing.Printer import io.AbstractFile +import config.Config import Decorators.SymbolIteratorDecorator @@ -643,14 +644,15 @@ object Denotations { type AsSeenFromResult <: PreDenotation /** The denotation with info(s) as seen from prefix type */ - final def asSeenFrom(pre: Type)(implicit ctx: Context): AsSeenFromResult = { - if ((cachedPrefix ne pre) || ctx.period != validAsSeenFrom) { - cachedAsSeenFrom = computeAsSeenFrom(pre) - cachedPrefix = pre - validAsSeenFrom = ctx.period - } - cachedAsSeenFrom - } + final def asSeenFrom(pre: Type)(implicit ctx: Context): AsSeenFromResult = + if (Config.cacheAsSeenFrom) { + if ((cachedPrefix ne pre) || ctx.period != validAsSeenFrom) { + cachedAsSeenFrom = computeAsSeenFrom(pre) + cachedPrefix = pre + validAsSeenFrom = ctx.period + } + cachedAsSeenFrom + } else computeAsSeenFrom(pre) protected def computeAsSeenFrom(pre: Type)(implicit ctx: Context): AsSeenFromResult -- cgit v1.2.3