diff options
author | Martin Odersky <odersky@gmail.com> | 2014-02-09 13:35:17 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2014-02-09 19:01:00 +0100 |
commit | f4e9a881a561e28900becc7deea520b43e57fb31 (patch) | |
tree | 04cda6a1f41717587fcb3ecb7c9e2a5cb59ac4ec /src/dotty/tools/dotc/core/Denotations.scala | |
parent | ada0febcb0893ff8f87d01f605a43f731e38a0be (diff) | |
download | dotty-f4e9a881a561e28900becc7deea520b43e57fb31.tar.gz dotty-f4e9a881a561e28900becc7deea520b43e57fb31.tar.bz2 dotty-f4e9a881a561e28900becc7deea520b43e57fb31.zip |
WIP: Fixes to bring symbols forward
Diffstat (limited to 'src/dotty/tools/dotc/core/Denotations.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/Denotations.scala | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/src/dotty/tools/dotc/core/Denotations.scala b/src/dotty/tools/dotc/core/Denotations.scala index 2ad193970..356e68f72 100644 --- a/src/dotty/tools/dotc/core/Denotations.scala +++ b/src/dotty/tools/dotc/core/Denotations.scala @@ -461,6 +461,18 @@ object Denotations { current } + protected def bringForward()(implicit ctx: Context): SingleDenotation = this match { + case denot: SymDenotation if ctx.stillValid(denot) => + 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 + case _ => + staleSymbolError + } + /** Produce a denotation that is valid for the given context. * Usually called when !(validFor contains ctx.period) * (even though this is not a precondition). @@ -476,17 +488,6 @@ object Denotations { def current(implicit ctx: Context): SingleDenotation = { val currentPeriod = ctx.period val valid = myValidFor - def bringForward(): SingleDenotation = this match { - case denot: SymDenotation if ctx.stillValid(denot) => - var d: SingleDenotation = denot - do { - d.validFor = Period(currentPeriod.runId, d.validFor.firstPhaseId, d.validFor.lastPhaseId) - d = d.nextInRun - } while (d ne denot) - initial.copyIfParentInvalid - case _ => - staleSymbolError - } if (valid.runId != currentPeriod.runId) bringForward.current else { var cur = this @@ -530,7 +531,7 @@ object Denotations { } def staleSymbolError(implicit ctx: Context) = - throw new Error(s"stale symbol; $this, defined in run ${myValidFor.runId} is referred to in run ${ctx.period.runId}") + throw new StaleSymbol(s"stale symbol; $this, defined in run ${myValidFor.runId} is referred to in run ${ctx.period.runId}") /** For ClassDenotations only: * If caches influenced by parent classes are still valid, the denotation @@ -757,5 +758,7 @@ object Denotations { else NoSymbol } + + class StaleSymbol(msg: String) extends Exception(msg) } |