diff options
-rw-r--r-- | META-INF/MANIFEST.MF | 15 | ||||
-rwxr-xr-x | src/compiler/scala/tools/nsc/interactive/Global.scala | 17 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/util/WorkScheduler.scala | 5 |
3 files changed, 21 insertions, 16 deletions
diff --git a/META-INF/MANIFEST.MF b/META-INF/MANIFEST.MF index 0cd64cca3c..7442856cd6 100644 --- a/META-INF/MANIFEST.MF +++ b/META-INF/MANIFEST.MF @@ -12,13 +12,18 @@ Bundle-ClassPath: lib/msil.jar Export-Package: scala.tools.nsc, - scala.tools.nsc.util, - scala.tools.nsc.io, - scala.tools.nsc.typechecker, - scala.tools.nsc.symtab, scala.tools.nsc.ast, scala.tools.nsc.ast.parser, - scala.tools.nsc.reporters + scala.tools.nsc.dependencies, + scala.tools.nsc.interactive, + scala.tools.nsc.interpreter, + scala.tools.nsc.io, + scala.tools.nsc.plugins, + scala.tools.nsc.reporters, + scala.tools.nsc.symtab, + scala.tools.nsc.symtab.classfile, + scala.tools.nsc.typechecker, + scala.tools.nsc.util Require-Bundle: org.apache.ant, scala.library diff --git a/src/compiler/scala/tools/nsc/interactive/Global.scala b/src/compiler/scala/tools/nsc/interactive/Global.scala index c912378385..ea2a396e09 100755 --- a/src/compiler/scala/tools/nsc/interactive/Global.scala +++ b/src/compiler/scala/tools/nsc/interactive/Global.scala @@ -72,7 +72,7 @@ self => // ----------------- Polling --------------------------------------- - private var pollingEnabled = false + private var pollingEnabled = true /** Called from runner thread and singnalDone */ def pollForWork() { @@ -96,6 +96,9 @@ self => // ----------------- The Background Runner Thread ----------------------- + /* Must be initialized before starting compilerRunner */ + private val scheduler = new WorkScheduler + /** The current presentation compiler runner */ private var compileRunner = newRunnerThread compileRunner.start() @@ -185,16 +188,16 @@ self => // ----------------- Implementations of client commmands ----------------------- /** Make sure a set of compilation units is loaded and parsed */ - def reload(sources: Set[SourceFile]) = { + def reload(sources: Set[SourceFile], reloaded: SyncVar[Unit]) = { currentTyperRun = new TyperRun() for (source <- sources) { - val unit = new RichCompilationUnit(source) - unitOfFile(source.file) = unit + val unit = unitOf(source) currentTyperRun.compileLate(unit) unit.status = JustParsed } outOfDate = true moveToFront(sources.toList map (_.file)) + reloaded.set(()) if (compiling) throw new FreshRunReq } @@ -318,8 +321,6 @@ self => // ----------------- interface to IDE ------------------------------------ - private val scheduler = new WorkScheduler - /** The compilation unit corresponding to a source file */ def unitOf(s: SourceFile): RichCompilationUnit = unitOfFile get s.file match { case Some(unit) => @@ -342,8 +343,8 @@ self => locateContext(unitOf(pos).contexts, pos) /** Make sure a set of compilation units is loaded and parsed */ - def askReload(sources: Set[SourceFile]) = - scheduler.postWorkItem(() => reload(sources)) + def askReload(sources: Set[SourceFile], reloaded: SyncVar[Unit]) = + scheduler.postWorkItem(() => reload(sources, reloaded)) /** Set sync var `result` to a fully attributed tree located at position `pos` */ def askTypeAt(pos: Position, result: SyncVar[Tree]) = diff --git a/src/compiler/scala/tools/nsc/util/WorkScheduler.scala b/src/compiler/scala/tools/nsc/util/WorkScheduler.scala index cd4d805701..bcd57ba6c2 100644 --- a/src/compiler/scala/tools/nsc/util/WorkScheduler.scala +++ b/src/compiler/scala/tools/nsc/util/WorkScheduler.scala @@ -12,7 +12,7 @@ class WorkScheduler { /** Called from server: block until todo list is nonempty */ def waitForMoreWork() = synchronized { - do { wait() } while (todo.isEmpty) + while (todo.isEmpty) { wait() } } /** called from Server: test whether todo list is nonempty */ @@ -44,7 +44,7 @@ class WorkScheduler { } /** Called from client: have action executed by server */ - def postWorkItem(action: Action) { + def postWorkItem(action: Action) = synchronized { todo enqueue action notify() } @@ -62,4 +62,3 @@ class WorkScheduler { if (working) except = Some(exc) } } - |