From 8f245d95f683dec681ea98406c438da32409c088 Mon Sep 17 00:00:00 2001 From: Donna Malayeri Date: Fri, 11 Mar 2011 15:54:57 +0000 Subject: Added a callback to Global.Run for fine-grain p... Added a callback to Global.Run for fine-grain progress reporting, to used by e.g., the Eclipse plugin. --- src/compiler/scala/tools/nsc/Global.scala | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/compiler/scala/tools/nsc/Global.scala b/src/compiler/scala/tools/nsc/Global.scala index c899e25302..5fd5538660 100644 --- a/src/compiler/scala/tools/nsc/Global.scala +++ b/src/compiler/scala/tools/nsc/Global.scala @@ -321,8 +321,10 @@ class Global(var settings: Settings, var reporter: Reporter) extends SymbolTable val unit0 = currentRun.currentUnit try { currentRun.currentUnit = unit - if (!cancelled(unit)) + if (!cancelled(unit)) { + currentRun.informUnitStarting(this, unit) reporter.withSource(unit.source) { apply(unit) } + } currentRun.advanceUnit } finally { //assert(currentRun.currentUnit == unit) @@ -714,6 +716,12 @@ class Global(var settings: Settings, var reporter: Reporter) extends SymbolTable */ def progress(current: Int, total: Int) {} + /** + * For subclasses to override. Called when `phase` is about to be run on `unit`. + * Variables are passed explicitly to indicate that `globalPhase` and `currentUnit` have been set. + */ + def informUnitStarting(phase: Phase, unit: CompilationUnit) { } + /** take note that phase is completed * (for progress reporting) */ -- cgit v1.2.3