@@ -12,7 +12,7 @@ import typer.Typer
12
12
import typer .ImportInfo .withRootImports
13
13
import Decorators .*
14
14
import io .AbstractFile
15
- import Phases .{unfusedPhases , Phase }
15
+ import Phases .{assemblePhases , unfusedPhases , Phase }
16
16
17
17
import sbt .interfaces .ProgressCallback
18
18
@@ -270,19 +270,12 @@ class Run(comp: Compiler, ictx: Context) extends ImplicitRunInfo with Constraint
270
270
report.echo(this .enrichErrorMessage(s " exception occurred while compiling ${files1.map(_.path)}" ))
271
271
throw ex
272
272
273
- /** TODO: There's a fundamental design problem here: We assemble phases using `fusePhases`
274
- * when we first build the compiler. But we modify them with -Yskip, -Ystop
275
- * on each run. That modification needs to either transform the tree structure,
276
- * or we need to assemble phases on each run, and take -Yskip, -Ystop into
277
- * account. I think the latter would be preferable.
278
- */
279
273
def compileSources (sources : List [SourceFile ]): Unit =
280
274
if (sources forall (_.exists)) {
281
275
units = sources.map(CompilationUnit (_))
282
276
compileUnits()
283
277
}
284
278
285
-
286
279
def compileUnits (us : List [CompilationUnit ]): Unit = {
287
280
units = us
288
281
compileUnits()
@@ -308,23 +301,9 @@ class Run(comp: Compiler, ictx: Context) extends ImplicitRunInfo with Constraint
308
301
then ActiveProfile (ctx.settings.VprofileDetails .value.max(0 ).min(1000 ))
309
302
else NoProfile
310
303
311
- // If testing pickler, make sure to stop after pickling phase:
312
- val stopAfter =
313
- if (ctx.settings.YtestPickler .value) List (" pickler" )
314
- else ctx.settings.YstopAfter .value
315
-
316
- val runCtx = ctx.fresh
304
+ val runCtx = assemblePhases()
317
305
runCtx.setProfiler(Profiler ())
318
306
319
- val pluginPlan = ctx.base.addPluginPhases(ctx.base.phasePlan)
320
- val phases = ctx.base.fusePhases(pluginPlan,
321
- ctx.settings.Yskip .value, ctx.settings.YstopBefore .value, stopAfter, ctx.settings.Ycheck .value)
322
- ctx.base.usePhases(phases, runCtx)
323
- val phasesSettings = List (" -Vphases" , " -Vprint" )
324
- for phasesSetting <- ctx.settings.allSettings if phasesSettings.contains(phasesSetting.name) do
325
- for case vs : List [String ] <- phasesSetting.userValue; p <- vs do
326
- if ! phases.exists(List (p).containsPhase) then report.warning(s " ' $p' specifies no phase " )
327
-
328
307
if ctx.settings.YnoDoubleBindings .value then
329
308
ctx.base.checkNoDoubleBindings = true
330
309
@@ -334,7 +313,7 @@ class Run(comp: Compiler, ictx: Context) extends ImplicitRunInfo with Constraint
334
313
var phasesWereAdjusted = false
335
314
336
315
var forceReachPhaseMaybe =
337
- if (ctx.isBestEffort && phases .exists(_.phaseName == " typer" )) Some (" typer" )
316
+ if (ctx.isBestEffort && allPhases .exists(_.phaseName == " typer" )) Some (" typer" )
338
317
else None
339
318
340
319
for phase <- allPhases do
0 commit comments