@@ -321,10 +321,10 @@ object Phases {
321
321
def run (using Context ): Unit
322
322
323
323
/** @pre `isRunnable` returns true */
324
- def runOn (units : List [CompilationUnit ])(using Context ): List [CompilationUnit ] =
324
+ def runOn (units : List [CompilationUnit ])(using runCtx : Context ): List [CompilationUnit ] =
325
325
units.map { unit =>
326
- val unitCtx = ctx .fresh.setPhase(this .start).setCompilationUnit(unit).withRootImports
327
- try run( using unitCtx)
326
+ given unitCtx : Context = runCtx .fresh.setPhase(this .start).setCompilationUnit(unit).withRootImports
327
+ try run
328
328
catch case ex : Throwable if ! ctx.run.enrichedErrorMessage =>
329
329
println(ctx.run.enrichErrorMessage(s " unhandled exception while running $phaseName on $unit" ))
330
330
throw ex
@@ -425,8 +425,8 @@ object Phases {
425
425
final def prev : Phase =
426
426
if (id > FirstPhaseId ) myBase.phases(start - 1 ) else NoPhase
427
427
428
- final def prevMega (using Context ): Phase =
429
- ctx.base.fusedContaining(ctx.phase.prev )
428
+ final def megaPhase (using Context ): Phase =
429
+ ctx.base.fusedContaining(this )
430
430
431
431
final def next : Phase =
432
432
if (hasNext) myBase.phases(end + 1 ) else NoPhase
@@ -439,8 +439,8 @@ object Phases {
439
439
final def monitor (doing : String )(body : => Unit )(using Context ): Unit =
440
440
try body
441
441
catch
442
- case NonFatal (ex) =>
443
- report.echo(s " exception occurred while $doing ${ctx.compilationUnit}" )
442
+ case NonFatal (ex) if ! ctx.run.enrichedErrorMessage =>
443
+ report.echo(ctx.run.enrichErrorMessage( s " exception occurred while $doing ${ctx.compilationUnit}" ) )
444
444
throw ex
445
445
446
446
override def toString : String = phaseName
0 commit comments