From 521267d23e548ba191028dd7d93d26f803c8fb77 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Wed, 29 Sep 2010 09:57:49 +0000 Subject: Closes #3875. Review by vigdorchick. --- .../tools/nsc/interactive/CompilerControl.scala | 2 +- .../scala/tools/nsc/interactive/Global.scala | 21 ++++++++++++--------- 2 files changed, 13 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/compiler/scala/tools/nsc/interactive/CompilerControl.scala b/src/compiler/scala/tools/nsc/interactive/CompilerControl.scala index 5258849b8c..7edb0263fc 100644 --- a/src/compiler/scala/tools/nsc/interactive/CompilerControl.scala +++ b/src/compiler/scala/tools/nsc/interactive/CompilerControl.scala @@ -91,7 +91,7 @@ trait CompilerControl { self: Global => /** Make sure a set of compilation units is loaded and parsed. * Return () to syncvar `result` on completion. */ - def askReload(sources: List[SourceFile], result: Response[Unit]) = + def askReload(sources: Seq[SourceFile], result: Response[Unit]) = scheduler postWorkItem new WorkItem { def apply() = reload(sources, result) override def toString = "reload "+sources diff --git a/src/compiler/scala/tools/nsc/interactive/Global.scala b/src/compiler/scala/tools/nsc/interactive/Global.scala index 51aaa5125d..5449cb83a5 100644 --- a/src/compiler/scala/tools/nsc/interactive/Global.scala +++ b/src/compiler/scala/tools/nsc/interactive/Global.scala @@ -33,7 +33,7 @@ self => * All units in firsts are typechecked before any unit not in this list * Modified by askToDoFirst, reload, typeAtTree. */ - var firsts: List[SourceFile] = List() + var firsts: Seq[SourceFile] = Seq() /** A map of all loaded files to the rich compilation units that correspond to them. */ @@ -210,9 +210,11 @@ self => /** The current presentation compiler runner */ private var compileRunner = newRunnerThread + private var threadId = 1 + /** Create a new presentation compiler runner. */ - def newRunnerThread: Thread = new Thread("Scala Presentation Compiler") { + def newRunnerThread: Thread = new Thread("Scala Presentation Compiler V"+threadId) { override def run() { try { while (true) { @@ -240,6 +242,7 @@ self => } } } + threadId += 1 start() } @@ -254,7 +257,7 @@ self => val prefix = firsts map unitOf - val units = prefix ::: (unitOfFile.values.toList diff prefix) filter (!_.isUpToDate) + val units = prefix ++ (unitOfFile.values.toSeq diff prefix) filter (!_.isUpToDate) recompile(units) @@ -285,7 +288,7 @@ self => /** Make sure symbol and type attributes are reset and recompile units. */ - def recompile(units: List[RichCompilationUnit]) { + def recompile(units: Seq[RichCompilationUnit]) { for (unit <- units) { reset(unit) if (debugIDE) inform("parsing: "+unit) @@ -296,7 +299,7 @@ self => activeLocks = 0 currentTyperRun.typeCheck(unit) unit.status = currentRunId - syncTopLevelSyms(unit) + if (!unit.isJava) syncTopLevelSyms(unit) } } @@ -312,8 +315,8 @@ self => } /** Move list of files to front of firsts */ - def moveToFront(fs: List[SourceFile]) { - firsts = fs ::: (firsts diff fs) + def moveToFront(fs: Seq[SourceFile]) { + firsts = fs ++ (firsts diff fs) } // ----------------- Implementations of client commands ----------------------- @@ -349,7 +352,7 @@ self => } /** Make sure a set of compilation units is loaded and parsed */ - def reloadSources(sources: List[SourceFile]) { + def reloadSources(sources: Seq[SourceFile]) { currentTyperRun = newTyperRun for (source <- sources) { val unit = new RichCompilationUnit(source) @@ -360,7 +363,7 @@ self => } /** Make sure a set of compilation units is loaded and parsed */ - def reload(sources: List[SourceFile], response: Response[Unit]) { + def reload(sources: Seq[SourceFile], response: Response[Unit]) { respond(response)(reloadSources(sources)) if (outOfDate) throw FreshRunReq // cancel background compile else outOfDate = true // proceed normally and enable new background compile -- cgit v1.2.3