diff options
author | Martin Odersky <odersky@gmail.com> | 2014-09-17 10:01:48 +0200 |
---|---|---|
committer | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2014-10-11 08:24:35 +0200 |
commit | 8918bd94813c254dcd0e19d0c16726bb5450e27a (patch) | |
tree | 83adc4b412667dcd6a6869cb5ab8e688a872208e /src/dotty/tools/dotc/core/Denotations.scala | |
parent | 70087826a64e027b72fc8235172bf2eee04b9d20 (diff) | |
download | dotty-8918bd94813c254dcd0e19d0c16726bb5450e27a.tar.gz dotty-8918bd94813c254dcd0e19d0c16726bb5450e27a.tar.bz2 dotty-8918bd94813c254dcd0e19d0c16726bb5450e27a.zip |
Make enteredAfter, installAfter more forgiving as to when they are called.
Instead of requiring to be called a given phase, change the context if
that is not the case.
Diffstat (limited to 'src/dotty/tools/dotc/core/Denotations.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/Denotations.scala | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/src/dotty/tools/dotc/core/Denotations.scala b/src/dotty/tools/dotc/core/Denotations.scala index 9970c5948..09b67d08a 100644 --- a/src/dotty/tools/dotc/core/Denotations.scala +++ b/src/dotty/tools/dotc/core/Denotations.scala @@ -603,26 +603,26 @@ object Denotations { */ protected def installAfter(phase: DenotTransformer)(implicit ctx: Context): Unit = { val targetId = phase.next.id - assert(ctx.phaseId == targetId, - s"denotation update for $this called in phase ${ctx.phase}, expected was ${phase.next}") - val current = symbol.current - // println(s"installing $this after $phase/${phase.id}, valid = ${current.validFor}") - // printPeriods(current) - this.nextInRun = current.nextInRun - this.validFor = Period(ctx.runId, targetId, current.validFor.lastPhaseId) - if (current.validFor.firstPhaseId == targetId) { - // replace current with this denotation - var prev = current - while (prev.nextInRun ne current) prev = prev.nextInRun - prev.nextInRun = this - current.validFor = Nowhere - } + if (ctx.phaseId != targetId) installAfter(phase)(ctx.withPhase(phase.next)) else { - // insert this denotation after current - current.validFor = Period(ctx.runId, current.validFor.firstPhaseId, targetId - 1) - current.nextInRun = this - } + val current = symbol.current + // println(s"installing $this after $phase/${phase.id}, valid = ${current.validFor}") + // printPeriods(current) + this.nextInRun = current.nextInRun + this.validFor = Period(ctx.runId, targetId, current.validFor.lastPhaseId) + if (current.validFor.firstPhaseId == targetId) { + // replace current with this denotation + var prev = current + while (prev.nextInRun ne current) prev = prev.nextInRun + prev.nextInRun = this + current.validFor = Nowhere + } else { + // insert this denotation after current + current.validFor = Period(ctx.runId, current.validFor.firstPhaseId, targetId - 1) + current.nextInRun = this + } // printPeriods(this) + } } def staleSymbolError(implicit ctx: Context) = { |