aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/Contexts.scala
diff options
context:
space:
mode:
authorDmitry Petrashko <dmitry.petrashko@gmail.com>2014-03-26 18:07:24 +0100
committerDmitry Petrashko <dmitry.petrashko@gmail.com>2014-03-27 15:02:53 +0100
commitded9e61673261bf4534ee6b5a66ff9b5554a6ed0 (patch)
tree3f6bd9f906b7b5ea79d343c9d713223bc946274f /src/dotty/tools/dotc/core/Contexts.scala
parent97faee5a82b40b4c980c8cb222ff5ac4cb9083a4 (diff)
downloaddotty-ded9e61673261bf4534ee6b5a66ff9b5554a6ed0.tar.gz
dotty-ded9e61673261bf4534ee6b5a66ff9b5554a6ed0.tar.bz2
dotty-ded9e61673261bf4534ee6b5a66ff9b5554a6ed0.zip
Fix #95: Phases now have their own periods.
Diffstat (limited to 'src/dotty/tools/dotc/core/Contexts.scala')
-rw-r--r--src/dotty/tools/dotc/core/Contexts.scala12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/dotty/tools/dotc/core/Contexts.scala b/src/dotty/tools/dotc/core/Contexts.scala
index 12a83185e..8d083b29c 100644
--- a/src/dotty/tools/dotc/core/Contexts.scala
+++ b/src/dotty/tools/dotc/core/Contexts.scala
@@ -280,10 +280,14 @@ object Contexts {
final def withMode(mode: Mode): Context =
if (mode != this.mode) fresh.setMode(mode) else this
- final def withPhase(phase: PhaseId): Context =
- if (this.phaseId == phaseId) this else fresh.setPhase(phase)
+ /**
+ * This method will always return a phase period equal to phaseId, thus will never return squashed phases
+ */
+ final def withPhase(phaseId: PhaseId): Context =
+ if (this.phaseId == phaseId) this else fresh.setPhase(phaseId)
final def withPhase(phase: Phase): Context =
- withPhase(phase.id)
+ if (this.period == phase.period) this else fresh.setPhase(phase)
+
final def addMode(mode: Mode): Context = withMode(this.mode | mode)
final def maskMode(mode: Mode): Context = withMode(this.mode & mode)
@@ -330,7 +334,7 @@ object Contexts {
def setProperty(prop: (String, Any)): this.type = setMoreProperties(moreProperties + prop)
def setPhase(pid: PhaseId): this.type = setPeriod(Period(runId, pid))
- def setPhase(phase: Phase): this.type = setPhase(phase.id)
+ def setPhase(phase: Phase): this.type = setPeriod(Period(runId, phase.start, phase.end))
def setSetting[T](setting: Setting[T], value: T): this.type =
setSettings(setting.updateIn(sstate, value))