diff options
author | Martin Odersky <odersky@gmail.com> | 2010-10-29 08:56:15 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2010-10-29 08:56:15 +0000 |
commit | a2ce51bcb7f5681d81240e233cdf452f35a757db (patch) | |
tree | ad44e1f37a8ae92ef761ac97f55e286ddb85dd55 | |
parent | b4afd4c86b1eb76b03acb706a34979532fd08c8d (diff) | |
download | scala-a2ce51bcb7f5681d81240e233cdf452f35a757db.tar.gz scala-a2ce51bcb7f5681d81240e233cdf452f35a757db.tar.bz2 scala-a2ce51bcb7f5681d81240e233cdf452f35a757db.zip |
presentation compiler hardenings.
5 files changed, 17 insertions, 7 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala index 504705c96a..1732bb73a3 100644 --- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala +++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala @@ -530,10 +530,14 @@ self => if ((doc ne null) && doc.raw.length > 0) { val joined = trees map { t => - val dd = DocDef(doc, t) - val defnPos = t.pos - val pos = doc.pos.withEnd(defnPos.endOrPoint) - dd setPos (if (defnPos.isOpaqueRange) pos else pos.makeTransparent) + DocDef(doc, t) setPos { + if (t.pos.isDefined) { + val pos = doc.pos.withEnd(t.pos.endOrPoint) + if (t.pos.isOpaqueRange) pos else pos.makeTransparent + } else { + t.pos + } + } } joined.find(_.pos.isOpaqueRange) foreach { main => diff --git a/src/compiler/scala/tools/nsc/interactive/Response.scala b/src/compiler/scala/tools/nsc/interactive/Response.scala index 56a48e44cd..67bb1633ad 100644 --- a/src/compiler/scala/tools/nsc/interactive/Response.scala +++ b/src/compiler/scala/tools/nsc/interactive/Response.scala @@ -62,7 +62,7 @@ class Response[T] { * When timeout ends, will return last stored provisional result, * or else None if no provisional result was stored. */ - def get(timeout: Long): Option[Either[T, Throwable]] = { + def get(timeout: Long): Option[Either[T, Throwable]] = synchronized { val start = System.currentTimeMillis var current = start while (!complete && start + timeout > current) { @@ -95,3 +95,7 @@ class Response[T] { cancelled = false } } + + + + diff --git a/src/compiler/scala/tools/nsc/typechecker/Analyzer.scala b/src/compiler/scala/tools/nsc/typechecker/Analyzer.scala index 0e2920a852..c0b4ab5ca5 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Analyzer.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Analyzer.scala @@ -75,7 +75,7 @@ trait Analyzer extends AnyRef val runsRightAfter = Some("packageobjects") def newPhase(_prev: Phase): StdPhase = new StdPhase(_prev) { override def keepsTypeParams = false - resetTyper() // this does not in fact to the reset for each compilation run! + resetTyper() override def run { val start = startTimer(typerNanos) global.echoPhaseSummary(this) diff --git a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala index 7f182326dd..7136945de6 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala @@ -90,6 +90,7 @@ trait Contexts { self: Analyzer => sc = sc.outer } } + class Context private[typechecker] { var unit: CompilationUnit = _ var tree: Tree = _ // Tree associated with this context diff --git a/src/compiler/scala/tools/nsc/util/WorkScheduler.scala b/src/compiler/scala/tools/nsc/util/WorkScheduler.scala index 509efca8e5..17aa91b2a3 100644 --- a/src/compiler/scala/tools/nsc/util/WorkScheduler.scala +++ b/src/compiler/scala/tools/nsc/util/WorkScheduler.scala @@ -26,8 +26,9 @@ class WorkScheduler { if (todo.isEmpty) None else Some(todo.dequeue()) } - def dequeueAll[T](f: Action => Option[T]): Seq[T] = + def dequeueAll[T](f: Action => Option[T]): Seq[T] = synchronized { todo.dequeueAll(a => f(a).isDefined).map(a => f(a).get) + } /** Called from server: return optional exception posted by client * Reset to no exception. |