diff options
Diffstat (limited to 'src/dotty/tools/dotc')
-rw-r--r-- | src/dotty/tools/dotc/core/Contexts.scala | 8 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/Phases.scala | 2 |
2 files changed, 6 insertions, 4 deletions
diff --git a/src/dotty/tools/dotc/core/Contexts.scala b/src/dotty/tools/dotc/core/Contexts.scala index 6824cc36c..805b7660c 100644 --- a/src/dotty/tools/dotc/core/Contexts.scala +++ b/src/dotty/tools/dotc/core/Contexts.scala @@ -77,7 +77,10 @@ object Contexts { /** The current context */ private[this] var _period: Period = _ - protected def period_=(period: Period) = _period = period + protected def period_=(period: Period) = { + assert(period.firstPhaseId == period.lastPhaseId, period) + _period = period + } def period: Period = _period /** The scope nesting level */ @@ -193,7 +196,7 @@ object Contexts { /** This context at given phase. * This method will always return a phase period equal to phaseId, thus will never return squashed phases */ - final def withPhase(phaseId: PhaseId): Context = { + final def withPhase(phaseId: PhaseId): Context = if (this.phaseId == phaseId) this else if (phasedCtx.phaseId == phaseId) phasedCtx else if (phasedCtxs != null && phasedCtxs(phaseId) != null) phasedCtxs(phaseId) @@ -206,7 +209,6 @@ object Contexts { } ctx1 } - } final def withPhase(phase: Phase): Context = withPhase(phase.id) diff --git a/src/dotty/tools/dotc/core/Phases.scala b/src/dotty/tools/dotc/core/Phases.scala index ffe2ddbea..c1bc243a0 100644 --- a/src/dotty/tools/dotc/core/Phases.scala +++ b/src/dotty/tools/dotc/core/Phases.scala @@ -194,7 +194,7 @@ object Phases { def runOn(units: List[CompilationUnit])(implicit ctx: Context): List[CompilationUnit] = units.map { unit => - val unitCtx = ctx.fresh.setPhase(this).setCompilationUnit(unit) + val unitCtx = ctx.fresh.setPhase(this.start).setCompilationUnit(unit) run(unitCtx) unitCtx.compilationUnit } |