summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc
diff options
context:
space:
mode:
authorMiles Sabin <miles@milessabin.com>2009-10-30 13:05:17 +0000
committerMiles Sabin <miles@milessabin.com>2009-10-30 13:05:17 +0000
commitacaad2bcfe6fbf1da3667551637225d905c7cdfd (patch)
treeead6efeb3f920aed169e522d47ef0bc395df6978 /src/compiler/scala/tools/nsc
parent6f7723bea494da2616edc1877d2402d356787512 (diff)
downloadscala-acaad2bcfe6fbf1da3667551637225d905c7cdfd.tar.gz
scala-acaad2bcfe6fbf1da3667551637225d905c7cdfd.tar.bz2
scala-acaad2bcfe6fbf1da3667551637225d905c7cdfd.zip
Added -Ybuilder-debug:[none,simple,refined] opt...
Added -Ybuilder-debug:[none,simple,refined] option for testing the interactive build manager; added support for reporting comments during compilation; unbroke the test.positions build target.
Diffstat (limited to 'src/compiler/scala/tools/nsc')
-rw-r--r--src/compiler/scala/tools/nsc/CompilationUnits.scala3
-rw-r--r--src/compiler/scala/tools/nsc/Main.scala18
-rw-r--r--src/compiler/scala/tools/nsc/Settings.scala1
-rw-r--r--src/compiler/scala/tools/nsc/ast/parser/Scanners.scala5
-rw-r--r--src/compiler/scala/tools/nsc/reporters/Reporter.scala2
5 files changed, 28 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/CompilationUnits.scala b/src/compiler/scala/tools/nsc/CompilationUnits.scala
index e594a06efa..af5eb88ebe 100644
--- a/src/compiler/scala/tools/nsc/CompilationUnits.scala
+++ b/src/compiler/scala/tools/nsc/CompilationUnits.scala
@@ -78,6 +78,9 @@ trait CompilationUnits { self: Global =>
def incompleteInputError(pos: Position, msg:String) =
reporter.incompleteInputError(pos, msg)
+ def comment(pos: Position, msg: String) =
+ reporter.comment(pos, msg)
+
/** Is this about a .java source file? */
lazy val isJava = source.file.name.endsWith(".java")
diff --git a/src/compiler/scala/tools/nsc/Main.scala b/src/compiler/scala/tools/nsc/Main.scala
index 253eebfd0d..58df3f8665 100644
--- a/src/compiler/scala/tools/nsc/Main.scala
+++ b/src/compiler/scala/tools/nsc/Main.scala
@@ -10,6 +10,8 @@ import java.io.File
import scala.concurrent.SyncVar
+import scala.tools.nsc.interactive.{ RefinedBuildManager, SimpleBuildManager }
+import scala.tools.nsc.io.AbstractFile
import scala.tools.nsc.reporters.{Reporter, ConsoleReporter}
import scala.tools.nsc.util.{ BatchSourceFile, FakePos } //{Position}
@@ -62,6 +64,22 @@ object Main extends AnyRef with EvalLoop {
case None => reporter.reset // Causes other compiler errors to be ignored
}
askShutdown
+ } else if (command.settings.Ybuilderdebug.value != "none") {
+ def fileSet(files : List[String]) = Set.empty ++ (files map AbstractFile.getFile)
+
+ val buildManager = if (command.settings.Ybuilderdebug.value == "simple")
+ new SimpleBuildManager(settings)
+ else
+ new RefinedBuildManager(settings)
+
+ buildManager.addSourceFiles(fileSet(command.files))
+
+ // enter resident mode
+ loop { line =>
+ val args = line.split(' ').toList
+ val command = new CompilerCommand(args.toList, settings, error, true)
+ buildManager.update(fileSet(command.files), Set.empty)
+ }
}
else {
if (command.settings.target.value == "msil") {
diff --git a/src/compiler/scala/tools/nsc/Settings.scala b/src/compiler/scala/tools/nsc/Settings.scala
index 9ad8a353b8..f6221ac14b 100644
--- a/src/compiler/scala/tools/nsc/Settings.scala
+++ b/src/compiler/scala/tools/nsc/Settings.scala
@@ -832,6 +832,7 @@ trait ScalacSettings {
val specialize = BooleanSetting ("-Yspecialize", "Specialize generic code on types.")
val Yrangepos = BooleanSetting ("-Yrangepos", "Use range positions for syntax trees.")
val Yidedebug = BooleanSetting ("-Yide-debug", "Generate, validate and output trees using the interactive compiler.")
+ val Ybuilderdebug = ChoiceSetting ("-Ybuilder-debug", "Compile using the specified build manager", List("none", "refined", "simple"), "none")
val Ytyperdebug = BooleanSetting ("-Ytyper-debug", "Trace all type assignements")
val Ypmatdebug = BooleanSetting ("-Ypmat-debug", "Trace all pattern matcher activity.")
val Ytailrec = BooleanSetting ("-Ytailrecommend", "Alert methods which would be tail-recursive if private or final.")
diff --git a/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala b/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala
index acc2029eb6..cf57685402 100644
--- a/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala
@@ -1083,11 +1083,14 @@ trait Scanners {
}
override def foundComment(value: String, start: Int, end: Int) {
- unit.comments += unit.Comment(value, new RangePosition(unit.source, start, start, end))
+ val pos = new RangePosition(unit.source, start, start, end)
+ unit.comments += unit.Comment(value, pos)
+ unit.comment(pos, value)
}
override def foundDocComment(value: String, start: Int, end: Int) {
docOffset = new RangePosition(unit.source, start, start, end)
+ unit.comment(docOffset, value)
}
}
diff --git a/src/compiler/scala/tools/nsc/reporters/Reporter.scala b/src/compiler/scala/tools/nsc/reporters/Reporter.scala
index dac52f8337..0d8939c168 100644
--- a/src/compiler/scala/tools/nsc/reporters/Reporter.scala
+++ b/src/compiler/scala/tools/nsc/reporters/Reporter.scala
@@ -46,6 +46,8 @@ abstract class Reporter {
def warning(pos: Position, msg: String ) { info0(pos, msg, WARNING, false) }
def error(pos: Position, msg: String ) { info0(pos, msg, ERROR, false) }
+ def comment(pos: Position, msg: String) {}
+
/** An error that could possibly be fixed if the unit were longer.
* This is used only when the interpreter tries
* to distinguish fatal errors from those that are due to