diff options
Diffstat (limited to 'src/compiler/scala/tools/nsc/Main.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/Main.scala | 80 |
1 files changed, 13 insertions, 67 deletions
diff --git a/src/compiler/scala/tools/nsc/Main.scala b/src/compiler/scala/tools/nsc/Main.scala index 7d112dfb3e..a66ee572a9 100644 --- a/src/compiler/scala/tools/nsc/Main.scala +++ b/src/compiler/scala/tools/nsc/Main.scala @@ -2,80 +2,26 @@ * Copyright 2005-2013 LAMP/EPFL * @author Martin Odersky */ +package scala.tools +package nsc -package scala.tools.nsc - -import java.io.File -import File.pathSeparator - -import scala.tools.nsc.interactive.{ RefinedBuildManager, SimpleBuildManager } -import scala.tools.nsc.io.AbstractFile -import scala.tools.nsc.reporters.{Reporter, ConsoleReporter} -import scala.reflect.internal.util.{ BatchSourceFile, FakePos } //{Position} -import Properties.msilLibPath +import scala.language.postfixOps /** The main class for NSC, a compiler for the programming - * language Scala. + * language Scala. */ -object Main extends Driver with EvalLoop { - - def resident(compiler: Global) { - loop { line => - val args = line.split(' ').toList - val command = new CompilerCommand(args, new Settings(scalacError)) - compiler.reporter.reset() - new compiler.Run() compile command.files - } +class MainClass extends Driver with EvalLoop { + def resident(compiler: Global): Unit = loop { line => + val command = new CompilerCommand(line split "\\s+" toList, new Settings(scalacError)) + compiler.reporter.reset() + new compiler.Run() compile command.files } - override def processSettingsHook(): Boolean = - if (settings.Yidedebug.value) { - settings.Xprintpos.value = true - settings.Yrangepos.value = true - val compiler = new interactive.Global(settings, reporter) - import compiler.{ reporter => _, _ } - - val sfs = command.files map getSourceFile - val reloaded = new interactive.Response[Unit] - askReload(sfs, reloaded) - - reloaded.get.right.toOption match { - case Some(ex) => reporter.cancelled = true // Causes exit code to be non-0 - case None => reporter.reset() // Causes other compiler errors to be ignored - } - askShutdown - false - } - else if (settings.Ybuilderdebug.value != "none") { - def fileSet(files : List[String]) = Set.empty ++ (files map AbstractFile.getFile) - - val buildManager = settings.Ybuilderdebug.value match { - case "simple" => new SimpleBuildManager(settings) - case _ => 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) - buildManager.update(fileSet(command.files), Set.empty) - } - false - } - else { - if (settings.target.value == "msil") - msilLibPath foreach (x => settings.assemrefs.value += (pathSeparator + x)) - true - } - - override def newCompiler(): Global = - if (settings.Yrangepos.value) new Global(settings, reporter) with interactive.RangePositions - else Global(settings, reporter) - + override def newCompiler(): Global = Global(settings, reporter) override def doCompile(compiler: Global) { - if (settings.resident.value) - resident(compiler) + if (settings.resident) resident(compiler) else super.doCompile(compiler) } } + +object Main extends MainClass { } |