diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/CompilationUnits.scala | 3 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/Main.scala | 18 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/Settings.scala | 1 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/ast/parser/Scanners.scala | 5 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/reporters/Reporter.scala | 2 |
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 |