diff options
author | Martin Odersky <odersky@gmail.com> | 2014-02-10 19:17:00 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2014-02-10 19:17:00 +0100 |
commit | 5870fbb7297b1b4bb70cbcf27cd88d4e12197234 (patch) | |
tree | 855fa843dde8b90041629786a22fa7e0187be4b3 /src/dotty/tools/dotc/core/Denotations.scala | |
parent | 18ae13dcf4f5d40d528e2bcf43a19e84bf475084 (diff) | |
download | dotty-5870fbb7297b1b4bb70cbcf27cd88d4e12197234.tar.gz dotty-5870fbb7297b1b4bb70cbcf27cd88d4e12197234.tar.bz2 dotty-5870fbb7297b1b4bb70cbcf27cd88d4e12197234.zip |
New scheme for incremental invalidation of parents.
Diffstat (limited to 'src/dotty/tools/dotc/core/Denotations.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/Denotations.scala | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/src/dotty/tools/dotc/core/Denotations.scala b/src/dotty/tools/dotc/core/Denotations.scala index 0d35f3cf9..6cbcd982f 100644 --- a/src/dotty/tools/dotc/core/Denotations.scala +++ b/src/dotty/tools/dotc/core/Denotations.scala @@ -17,8 +17,6 @@ import config.Config import util.common._ import Decorators.SymbolIteratorDecorator - - /** Denotations represent the meaning of symbols and named types. * The following diagram shows how the principal types of denotations * and their denoting entities relate to each other. Lines ending in @@ -463,12 +461,13 @@ object Denotations { protected def bringForward()(implicit ctx: Context): SingleDenotation = this match { case denot: SymDenotation if ctx.stillValid(denot) => + if (denot.exists) assert(ctx.runId > validFor.runId) var d: SingleDenotation = denot do { d.validFor = Period(ctx.period.runId, d.validFor.firstPhaseId, d.validFor.lastPhaseId) d = d.nextInRun } while (d ne denot) - initial.copyIfParentInvalid + initial.syncWithParents case _ => staleSymbolError } @@ -506,7 +505,7 @@ object Denotations { var startPid = cur.validFor.lastPhaseId + 1 val transformers = ctx.transformersFor(cur) val transformer = transformers.nextTransformer(startPid) - next = transformer.transform(cur).copyIfParentInvalid + next = transformer.transform(cur).syncWithParents if (next eq cur) startPid = cur.validFor.firstPhaseId else { @@ -530,14 +529,20 @@ object Denotations { } } - def staleSymbolError(implicit ctx: Context) = - throw new StaleSymbol(s"stale symbol; $this in ${this.asSymDenotation.owner}, defined in run ${myValidFor.runId}, is referred to in run ${ctx.period.runId}") + def staleSymbolError(implicit ctx: Context) = { + def ownerMsg = this match { + case denot: SymDenotation => s"in ${denot.owner}" + case _ => "" + } + def msg = s"stale symbol; $this#${symbol.id}$ownerMsg, defined in run ${myValidFor.runId}, is referred to in run ${ctx.period.runId}" + throw new StaleSymbol(msg) + } /** For ClassDenotations only: * If caches influenced by parent classes are still valid, the denotation * itself, otherwise a freshly initialized copy. */ - def copyIfParentInvalid(implicit ctx: Context): SingleDenotation = this + def syncWithParents(implicit ctx: Context): SingleDenotation = this override def toString = if (symbol == NoSymbol) symbol.toString @@ -759,6 +764,9 @@ object Denotations { NoSymbol } - class StaleSymbol(msg: String) extends Exception(msg) + /** An exception for accessing symbols that are no longer valid in current run */ + class StaleSymbol(msg: => String) extends Exception { + override def getMessage() = msg + } } |