diff options
author | Martin Odersky <odersky@gmail.com> | 2013-01-29 09:44:37 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2013-01-29 09:44:37 +0100 |
commit | bbc4f7a3234937e5f79e8310e6fff2f9b4af0f98 (patch) | |
tree | 36537cd033d5e37a489839f2970245df9db5e544 /src/dotty/tools/dotc/core/Periods.scala | |
parent | 9770566c50baff03a7e61344c203b29db8750e8f (diff) | |
download | dotty-bbc4f7a3234937e5f79e8310e6fff2f9b4af0f98.tar.gz dotty-bbc4f7a3234937e5f79e8310e6fff2f9b4af0f98.tar.bz2 dotty-bbc4f7a3234937e5f79e8310e6fff2f9b4af0f98.zip |
New Context architecture based on cloning
Diffstat (limited to 'src/dotty/tools/dotc/core/Periods.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/Periods.scala | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/src/dotty/tools/dotc/core/Periods.scala b/src/dotty/tools/dotc/core/Periods.scala index 97384e509..3a91b48cb 100644 --- a/src/dotty/tools/dotc/core/Periods.scala +++ b/src/dotty/tools/dotc/core/Periods.scala @@ -7,7 +7,7 @@ import Contexts._ * run ids represent compiler runs * phase ids represent compiler phases */ -abstract class Periods { self: Context => +abstract class Periods extends DotClass { self: Context => import Periods._ /** The current phase identifier */ @@ -16,23 +16,13 @@ abstract class Periods { self: Context => /** The current run identifier */ def runId = period.runId - /** A new context that differs from the current one in its period */ - def withPeriod(pd: Period): Context = - if (period == pd) this - else new SubContext(self) { - override val period = pd - } - - /** A new context that differs from the current one in its phase */ - def withPhase(pid: PhaseId): Context = withPeriod(Period(runId, pid)) - /** Execute `op` at given period */ def atPeriod[T](pd: Period)(op: Context => T) = - op(ctx withPeriod pd) + op(ctx.fresh.withPeriod(pd)) /** Execute `op` at given phase id */ def atPhase[T](pid: PhaseId)(op: Context => T) = - op(ctx withPhase pid) + op(ctx.fresh.withPhase(pid)) } object Periods { |