diff options
author | Adriaan Moors <adriaan.moors@typesafe.com> | 2013-02-07 15:12:33 -0800 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@typesafe.com> | 2013-02-07 15:12:33 -0800 |
commit | 033c6635b4ac03b9e6f335a76dabb65f1f0296cd (patch) | |
tree | b2defba531547eb30d4b1179af2debd57a409e13 /src | |
parent | 0dd02d92a363ee13b13eb4536c938d24bb5dd98d (diff) | |
parent | 79e774f584d5afed72f62b0a7f93f63765d0cb99 (diff) | |
download | scala-033c6635b4ac03b9e6f335a76dabb65f1f0296cd.tar.gz scala-033c6635b4ac03b9e6f335a76dabb65f1f0296cd.tar.bz2 scala-033c6635b4ac03b9e6f335a76dabb65f1f0296cd.zip |
Merge pull request #1993 from mads379/SI-7026-2.10.x
SI-7026 Asking for a parse tree will now never result in a typed tree
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/interactive/CompilerControl.scala | 13 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/interactive/Global.scala | 7 |
2 files changed, 10 insertions, 10 deletions
diff --git a/src/compiler/scala/tools/nsc/interactive/CompilerControl.scala b/src/compiler/scala/tools/nsc/interactive/CompilerControl.scala index b66f081fb9..73738ebd21 100644 --- a/src/compiler/scala/tools/nsc/interactive/CompilerControl.scala +++ b/src/compiler/scala/tools/nsc/interactive/CompilerControl.scala @@ -259,15 +259,12 @@ trait CompilerControl { self: Global => } /** Returns parse tree for source `source`. No symbols are entered. Syntax errors are reported. - * Can be called asynchronously from presentation compiler. + * + * This method is thread-safe and as such can safely run outside of the presentation + * compiler thread. */ - def parseTree(source: SourceFile): Tree = ask { () => - getUnit(source) match { - case Some(unit) if unit.status >= JustParsed => - unit.body - case _ => - new UnitParser(new CompilationUnit(source)).parse() - } + def parseTree(source: SourceFile): Tree = { + new UnitParser(new CompilationUnit(source)).parse() } /** Asks for a computation to be done quickly on the presentation compiler thread */ diff --git a/src/compiler/scala/tools/nsc/interactive/Global.scala b/src/compiler/scala/tools/nsc/interactive/Global.scala index c93f258997..105b0e4833 100644 --- a/src/compiler/scala/tools/nsc/interactive/Global.scala +++ b/src/compiler/scala/tools/nsc/interactive/Global.scala @@ -225,7 +225,10 @@ class Global(settings: Settings, _reporter: Reporter, projectName: String = "") /** Called from parser, which signals hereby that a method definition has been parsed. */ override def signalParseProgress(pos: Position) { - checkForMoreWork(pos) + // We only want to be interruptible when running on the PC thread. + if(onCompilerThread) { + checkForMoreWork(pos) + } } /** Called from typechecker, which signals hereby that a node has been completely typechecked. @@ -447,7 +450,7 @@ class Global(settings: Settings, _reporter: Reporter, projectName: String = "") */ @elidable(elidable.WARNING) override def assertCorrectThread() { - assert(initializing || (Thread.currentThread() eq compileRunner), + assert(initializing || onCompilerThread, "Race condition detected: You are running a presentation compiler method outside the PC thread.[phase: %s]".format(globalPhase) + " Please file a ticket with the current stack trace at https://www.assembla.com/spaces/scala-ide/support/tickets") } |