diff options
Diffstat (limited to 'src/compiler/scala/tools/nsc/interactive/CompilerControl.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/interactive/CompilerControl.scala | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/src/compiler/scala/tools/nsc/interactive/CompilerControl.scala b/src/compiler/scala/tools/nsc/interactive/CompilerControl.scala index 2ced0788c1..fb06dd69a6 100644 --- a/src/compiler/scala/tools/nsc/interactive/CompilerControl.scala +++ b/src/compiler/scala/tools/nsc/interactive/CompilerControl.scala @@ -130,13 +130,8 @@ trait CompilerControl { self: Global => /** Sets sync var `response` to the fully attributed & typechecked tree contained in `source`. * @pre `source` needs to be loaded. */ - def askType(source: SourceFile, forceReload: Boolean, response: Response[Tree]) = { - if (debugIDE) { - println("ask type called") - new Exception().printStackTrace() - } + def askType(source: SourceFile, forceReload: Boolean, response: Response[Tree]) = postWorkItem(new AskTypeItem(source, forceReload, response)) - } /** Sets sync var `response` to the position of the definition of the given link in * the given sourcefile. @@ -179,7 +174,7 @@ trait CompilerControl { self: Global => * the a NoSuchUnitError is raised in the response. */ def askLoadedTyped(source: SourceFile, response: Response[Tree]) = - postWorkItem(new AskLoadedTypedItem(source, response)) + postWorkItem(new AskLoadedTypedItem(source, response, onCompilerThread)) /** If source if not yet loaded, get an outline view with askParseEntered. * If source is loaded, wait for it to be typechecked. @@ -200,7 +195,7 @@ trait CompilerControl { self: Global => * @param response The response. */ def askParsedEntered(source: SourceFile, keepLoaded: Boolean, response: Response[Tree]) = - postWorkItem(new AskParsedEnteredItem(source, keepLoaded, response)) + postWorkItem(new AskParsedEnteredItem(source, keepLoaded, response, onCompilerThread)) /** Cancels current compiler run and start a fresh one where everything will be re-typechecked * (but not re-loaded). @@ -228,7 +223,7 @@ trait CompilerControl { self: Global => } /** Asks for a computation to be done quickly on the presentation compiler thread */ - def ask[A](op: () => A): A = scheduler doQuickly op + def ask[A](op: () => A): A = if (onCompilerThread) op() else scheduler doQuickly op /** Info given for every member found by completion */ @@ -293,13 +288,13 @@ trait CompilerControl { self: Global => override def toString = "linkpos "+sym+" in "+source } - class AskLoadedTypedItem(val source: SourceFile, response: Response[Tree]) extends WorkItem { - def apply() = self.waitLoadedTyped(source, response) + class AskLoadedTypedItem(val source: SourceFile, response: Response[Tree], val onSameThread: Boolean) extends WorkItem { + def apply() = self.waitLoadedTyped(source, response, onSameThread) override def toString = "wait loaded & typed "+source } - class AskParsedEnteredItem(val source: SourceFile, val keepLoaded: Boolean, response: Response[Tree]) extends WorkItem { - def apply() = self.getParsedEntered(source, keepLoaded, response) + class AskParsedEnteredItem(val source: SourceFile, val keepLoaded: Boolean, response: Response[Tree], val onSameThread: Boolean) extends WorkItem { + def apply() = self.getParsedEntered(source, keepLoaded, response, onSameThread) override def toString = "getParsedEntered "+source+", keepLoaded = "+keepLoaded } } |