summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiles Sabin <miles@milessabin.com>2009-05-26 10:18:52 +0000
committerMiles Sabin <miles@milessabin.com>2009-05-26 10:18:52 +0000
commit46bb8d600c4f47e044c40583cb3f564761eab035 (patch)
tree95c2911de2cb01200028c1745a2be24093308b14
parentc3247d415f558ce4630a374aba920e2e0c419b74 (diff)
downloadscala-46bb8d600c4f47e044c40583cb3f564761eab035.tar.gz
scala-46bb8d600c4f47e044c40583cb3f564761eab035.tar.bz2
scala-46bb8d600c4f47e044c40583cb3f564761eab035.zip
Export new packages; minor updates to interactive.
-rw-r--r--META-INF/MANIFEST.MF15
-rwxr-xr-xsrc/compiler/scala/tools/nsc/interactive/Global.scala17
-rw-r--r--src/compiler/scala/tools/nsc/util/WorkScheduler.scala5
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)
}
}
-