summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFrançois Garillot <francois@garillot.net>2013-09-11 15:34:34 +0200
committerFrançois Garillot <francois@garillot.net>2013-09-19 11:34:04 +0200
commit1103d48fb7bf6586f1609151bdcc74e27c9139d5 (patch)
tree6e71d6b4788f29456fa76516f77797071b41f8f6 /src
parentb0abc2d9e82ffb01fdeb423c8c10c69033d5f2dd (diff)
downloadscala-1103d48fb7bf6586f1609151bdcc74e27c9139d5.tar.gz
scala-1103d48fb7bf6586f1609151bdcc74e27c9139d5.tar.bz2
scala-1103d48fb7bf6586f1609151bdcc74e27c9139d5.zip
Add trait keeping comments across new Typer runs
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala7
-rw-r--r--src/interactive/scala/tools/nsc/interactive/Global.scala13
2 files changed, 19 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index 55268b1e1a..5c8f1bd1c7 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -43,12 +43,17 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper
final val shortenImports = false
+ // allows override of the behavior of the resetTyper method w.r.t comments
+ def resetDocComments() = {
+ clearDocComments()
+ }
+
def resetTyper() {
//println("resetTyper called")
resetContexts()
resetImplicits()
transformed.clear()
- clearDocComments()
+ resetDocComments()
}
object UnTyper extends Traverser {
diff --git a/src/interactive/scala/tools/nsc/interactive/Global.scala b/src/interactive/scala/tools/nsc/interactive/Global.scala
index bc6df9eb25..736a1e68c4 100644
--- a/src/interactive/scala/tools/nsc/interactive/Global.scala
+++ b/src/interactive/scala/tools/nsc/interactive/Global.scala
@@ -18,6 +18,19 @@ import scala.tools.nsc.typechecker.Analyzer
import symtab.Flags.{ACCESSOR, PARAMACCESSOR}
import scala.annotation.{ elidable, tailrec }
import scala.language.implicitConversions
+import scala.tools.nsc.typechecker.Typers
+
+/**
+ * This trait allows the IDE to have an instance of the PC that
+ * does not clear the comments table at every new typer run (those
+ * being many and close between in this context).
+ */
+
+trait CommentPreservingTypers extends Typers {
+ self: Analyzer =>
+
+ override def resetDocComments() = {}
+}
trait InteractiveScaladocAnalyzer extends InteractiveAnalyzer with ScaladocAnalyzer {
val global : Global