diff options
author | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2015-02-12 16:22:36 +0100 |
---|---|---|
committer | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2015-02-12 16:22:36 +0100 |
commit | 10167c46191c1b02246635b01dcd3d1e0b75497a (patch) | |
tree | 344972b494277024b7990c285ef56a24e26e7c00 /src/dotty/tools | |
parent | 5027f018be2879d0db5a13037abe4ac706ffbf42 (diff) | |
download | dotty-10167c46191c1b02246635b01dcd3d1e0b75497a.tar.gz dotty-10167c46191c1b02246635b01dcd3d1e0b75497a.tar.bz2 dotty-10167c46191c1b02246635b01dcd3d1e0b75497a.zip |
Check period validity once per run.
Diffstat (limited to 'src/dotty/tools')
-rw-r--r-- | src/dotty/tools/dotc/Run.scala | 3 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/Periods.scala | 7 |
2 files changed, 3 insertions, 7 deletions
diff --git a/src/dotty/tools/dotc/Run.scala b/src/dotty/tools/dotc/Run.scala index abee30aab..a182029e6 100644 --- a/src/dotty/tools/dotc/Run.scala +++ b/src/dotty/tools/dotc/Run.scala @@ -13,6 +13,9 @@ import scala.reflect.io.VirtualFile class Run(comp: Compiler)(implicit ctx: Context) { + assert(comp.phases.last.last.id <= Periods.MaxPossiblePhaseId) + assert(ctx.runId <= Periods.MaxPossibleRunId) + var units: List[CompilationUnit] = _ def getSource(fileName: String): SourceFile = { diff --git a/src/dotty/tools/dotc/core/Periods.scala b/src/dotty/tools/dotc/core/Periods.scala index cef85a07f..b4e22bd87 100644 --- a/src/dotty/tools/dotc/core/Periods.scala +++ b/src/dotty/tools/dotc/core/Periods.scala @@ -120,23 +120,16 @@ object Periods { /** The single-phase period consisting of given run id and phase id */ def apply(rid: RunId, pid: PhaseId): Period = { - assert(rid <= MaxPossibleRunId) - assert(pid <= MaxPossiblePhaseId) new Period(((rid << PhaseWidth) | pid) << PhaseWidth) } /** The period consisting of given run id, and lo/hi phase ids */ def apply(rid: RunId, loPid: PhaseId, hiPid: PhaseId): Period = { - assert(rid <= MaxPossibleRunId) - assert(loPid <= MaxPossiblePhaseId) - assert(hiPid <= MaxPossiblePhaseId) - new Period(((rid << PhaseWidth) | hiPid) << PhaseWidth | (hiPid - loPid)) } /** The interval consisting of all periods of given run id */ def allInRun(rid: RunId) = { - assert(rid <= MaxPossibleRunId) apply(rid, 0, PhaseMask) } } |