Skip to content

Commit da6829b

Browse files
committed
Rename Context#phases -> Phases.curPhases
1 parent 0ece69a commit da6829b

File tree

6 files changed

+12
-7
lines changed

6 files changed

+12
-7
lines changed

compiler/src/dotty/tools/dotc/Run.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import Scopes._
1010
import typer.{ImportInfo, Typer}
1111
import Decorators._
1212
import io.{AbstractFile, PlainFile}
13+
import Phases.curPhases
1314

1415
import scala.io.Codec
1516
import util.{Set => _, _}
@@ -194,7 +195,7 @@ class Run(comp: Compiler, ictx: Context) extends ImplicitRunInfo with Constraint
194195

195196
val runCtx = ctx.fresh
196197
runCtx.setProfiler(Profiler())
197-
ctx.phases.foreach(_.initContext(runCtx))
198+
curPhases.foreach(_.initContext(runCtx))
198199
runPhases(using runCtx)
199200
if (!ctx.reporter.hasErrors) Rewrites.writeBack()
200201
while (finalizeActions.nonEmpty) {

compiler/src/dotty/tools/dotc/core/Contexts.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,6 @@ object Contexts {
533533
def lambdaLiftPhase: Phase = base.lambdaLiftPhase
534534
def flattenPhase: Phase = base.flattenPhase
535535
def genBCodePhase: Phase = base.genBCodePhase
536-
def phases: Array[Phase] = base.phases
537536

538537
def settings: ScalaSettings = base.settings
539538
def definitions: Definitions = base.definitions

compiler/src/dotty/tools/dotc/core/Periods.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package dotty.tools.dotc.core
22

33
import Contexts._
4+
import Phases.curPhases
45

56
/** Periods are the central "clock" of the compiler
67
* A period consists of a run id and a phase id.
@@ -34,8 +35,8 @@ abstract class Periods { thisCtx: Context =>
3435
val period = thisCtx.period
3536
period == p ||
3637
period.runId == p.runId &&
37-
thisCtx.phases(period.phaseId).sameBaseTypesStartId ==
38-
thisCtx.phases(p.phaseId).sameBaseTypesStartId
38+
curPhases(period.phaseId).sameBaseTypesStartId ==
39+
curPhases(p.phaseId).sameBaseTypesStartId
3940
}
4041
}
4142

compiler/src/dotty/tools/dotc/core/Phases.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,9 @@ object Phases {
411411
override def toString: String = phaseName
412412
}
413413

414+
def curPhases(using Context): Array[Phase] = ctx.base.phases
415+
416+
414417
/** Replace all instances of `oldPhaseClass` in `current` phases
415418
* by the result of `newPhases` applied to the old phase.
416419
*/

compiler/src/dotty/tools/dotc/core/SymDenotations.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2582,8 +2582,8 @@ object SymDenotations {
25822582
def isValidAt(phase: Phase)(using Context) =
25832583
checkedPeriod == ctx.period ||
25842584
createdAt.runId == ctx.runId &&
2585-
createdAt.phaseId < ctx.phases.length &&
2586-
sameGroup(ctx.phases(createdAt.phaseId), phase) &&
2585+
createdAt.phaseId < curPhases.length &&
2586+
sameGroup(curPhases(createdAt.phaseId), phase) &&
25872587
{ checkedPeriod = ctx.period; true }
25882588
}
25892589

compiler/src/dotty/tools/repl/ReplDriver.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import java.io.{File => JFile, PrintStream}
55
import dotty.tools.dotc.ast.Trees._
66
import dotty.tools.dotc.ast.{tpd, untpd}
77
import dotty.tools.dotc.core.Contexts._
8+
import dotty.tools.dotc.core.Phases.curPhases
89
import dotty.tools.dotc.core.Denotations.Denotation
910
import dotty.tools.dotc.core.Flags._
1011
import dotty.tools.dotc.core.Mode
@@ -222,7 +223,7 @@ class ReplDriver(settings: Array[String],
222223
}
223224

224225
def extractTopLevelImports(ctx: Context): List[tpd.Import] =
225-
ctx.phases.collectFirst { case phase: CollectTopLevelImports => phase.imports }.get
226+
curPhases(using ctx).collectFirst { case phase: CollectTopLevelImports => phase.imports }.get
226227

227228
implicit val state = {
228229
val state0 = newRun(istate)

0 commit comments

Comments
 (0)