summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@typesafe.com>2014-06-26 11:22:04 +0200
committerAdriaan Moors <adriaan.moors@typesafe.com>2014-07-17 15:40:38 +0200
commit638b4c3f5b5721b68a6af97e237b4f056c2da7ed (patch)
tree9bccd325423dd12080bfeefb1ed7b51be55a1bcc /src/compiler
parent4b333fbf7a38be11e568bd71e2dc5dca00e3bce6 (diff)
downloadscala-638b4c3f5b5721b68a6af97e237b4f056c2da7ed.tar.gz
scala-638b4c3f5b5721b68a6af97e237b4f056c2da7ed.tar.bz2
scala-638b4c3f5b5721b68a6af97e237b4f056c2da7ed.zip
Regularize `comment` hook method
This is currently pretty borken, but let's at least not clutter innocent interfaces with this functionality. Moved `comment` (as `signalParsedDocComment`) next to the other hook methods in `Global`. For now, it calls the old `reporter.comment` hook method. As soon as the IDE is refactored to receive comments properly, the deprecated `Reporter#comment` method can be removed.
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/scala/tools/nsc/CompilationUnits.scala7
-rw-r--r--src/compiler/scala/tools/nsc/Global.scala8
2 files changed, 10 insertions, 5 deletions
diff --git a/src/compiler/scala/tools/nsc/CompilationUnits.scala b/src/compiler/scala/tools/nsc/CompilationUnits.scala
index f23bca77cd..0a356ed7b6 100644
--- a/src/compiler/scala/tools/nsc/CompilationUnits.scala
+++ b/src/compiler/scala/tools/nsc/CompilationUnits.scala
@@ -135,11 +135,8 @@ trait CompilationUnits { global: Global =>
@deprecated("Call global.currentRun.reporting.uncheckedWarning directly instead.", "2.11.2")
final def uncheckedWarning(pos: Position, msg: String): Unit = currentRun.reporting.uncheckedWarning(pos, msg)
- // called by ScalaDocAnalyzer, overridden by the IDE (in Reporter)
- // TODO: don't use reporter to communicate comments from parser to IDE!
- @deprecated("This method will be removed.", "2.11.2")
- final def comment(pos: Position, msg: String): Unit = reporter.comment(pos, msg)
-
+ @deprecated("This method will be removed. It does nothing.", "2.11.2")
+ final def comment(pos: Position, msg: String): Unit = {}
/** Is this about a .java source file? */
lazy val isJava = source.file.name.endsWith(".java")
diff --git a/src/compiler/scala/tools/nsc/Global.scala b/src/compiler/scala/tools/nsc/Global.scala
index 572e579aca..72464cea8a 100644
--- a/src/compiler/scala/tools/nsc/Global.scala
+++ b/src/compiler/scala/tools/nsc/Global.scala
@@ -218,6 +218,14 @@ class Global(var currentSettings: Settings, var reporter: Reporter)
/** Called from parser, which signals hereby that a method definition has been parsed. */
def signalParseProgress(pos: Position) {}
+ /** Called by ScalaDocAnalyzer when a doc comment has been parsed. */
+ def signalParsedDocComment(comment: String, pos: Position) = {
+ // TODO: this is all very borken (only works for scaladoc comments, not regular ones)
+ // --> add hooks to parser and refactor Interactive global to handle comments directly
+ // in any case don't use reporter for parser hooks
+ reporter.comment(pos, comment)
+ }
+
/** Register new context; called for every created context
*/
def registerContext(c: analyzer.Context) {