@@ -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
@@ -294,19 +294,12 @@ class Run(comp: Compiler, ictx: Context) extends ImplicitRunInfo with Constraint
294
294
report.echo(this .enrichErrorMessage(s " exception occurred while compiling ${files1.map(_.path)}" ))
295
295
throw ex
296
296
297
- /** TODO: There's a fundamental design problem here: We assemble phases using `fusePhases`
298
- * when we first build the compiler. But we modify them with -Yskip, -Ystop
299
- * on each run. That modification needs to either transform the tree structure,
300
- * or we need to assemble phases on each run, and take -Yskip, -Ystop into
301
- * account. I think the latter would be preferable.
302
- */
303
297
def compileSources (sources : List [SourceFile ]): Unit =
304
298
if (sources forall (_.exists)) {
305
299
units = sources.map(CompilationUnit (_))
306
300
compileUnits()
307
301
}
308
302
309
-
310
303
def compileUnits (us : List [CompilationUnit ]): Unit = {
311
304
units = us
312
305
compileUnits()
@@ -332,23 +325,9 @@ class Run(comp: Compiler, ictx: Context) extends ImplicitRunInfo with Constraint
332
325
then ActiveProfile (ctx.settings.VprofileDetails .value.max(0 ).min(1000 ))
333
326
else NoProfile
334
327
335
- // If testing pickler, make sure to stop after pickling phase:
336
- val stopAfter =
337
- if (ctx.settings.YtestPickler .value) List (" pickler" )
338
- else ctx.settings.YstopAfter .value
339
-
340
- val runCtx = ctx.fresh
328
+ val runCtx = assemblePhases()
341
329
runCtx.setProfiler(Profiler ())
342
330
343
- val pluginPlan = ctx.base.addPluginPhases(ctx.base.phasePlan)
344
- val phases = ctx.base.fusePhases(pluginPlan,
345
- ctx.settings.Yskip .value, ctx.settings.YstopBefore .value, stopAfter, ctx.settings.Ycheck .value)
346
- ctx.base.usePhases(phases, runCtx)
347
- val phasesSettings = List (" -Vphases" , " -Vprint" )
348
- for phasesSetting <- ctx.settings.allSettings if phasesSettings.contains(phasesSetting.name) do
349
- for case vs : List [String ] <- phasesSetting.userValue; p <- vs do
350
- if ! phases.exists(List (p).containsPhase) then report.warning(s " ' $p' specifies no phase " )
351
-
352
331
if ctx.settings.YnoDoubleBindings .value then
353
332
ctx.base.checkNoDoubleBindings = true
354
333
@@ -358,7 +337,7 @@ class Run(comp: Compiler, ictx: Context) extends ImplicitRunInfo with Constraint
358
337
var phasesWereAdjusted = false
359
338
360
339
var forceReachPhaseMaybe =
361
- if (ctx.isBestEffort && phases .exists(_.phaseName == " typer" )) Some (" typer" )
340
+ if (ctx.isBestEffort && allPhases .exists(_.phaseName == " typer" )) Some (" typer" )
362
341
else None
363
342
364
343
for phase <- allPhases do
0 commit comments