diff --git a/src/compiler/scala/tools/nsc/CompileServer.scala b/src/compiler/scala/tools/nsc/CompileServer.scala index f12033a19..938e572df 100644 --- a/src/compiler/scala/tools/nsc/CompileServer.scala +++ b/src/compiler/scala/tools/nsc/CompileServer.scala @@ -93,7 +93,7 @@ object CompileServer extends SocketServer { def error(msg: String): unit = reporter.error(/*new Position*/ FakePos("fsc"), msg + "\n fsc -help gives more information") - val command = new CompilerCommand(args, error, false) { + val command = new CompilerCommand(args, new Settings(error), error, false) { override val cmdName = "fsc" settings.disable(settings.prompt) settings.disable(settings.resident) diff --git a/src/compiler/scala/tools/nsc/CompilerCommand.scala b/src/compiler/scala/tools/nsc/CompilerCommand.scala index d5bd523ef..081af5b92 100644 --- a/src/compiler/scala/tools/nsc/CompilerCommand.scala +++ b/src/compiler/scala/tools/nsc/CompilerCommand.scala @@ -10,15 +10,14 @@ package scala.tools.nsc import compat.StringBuilder /** A class representing command line info for scalac */ -class CompilerCommand(arguments: List[String], error: String => unit, interactive: boolean) { +class CompilerCommand(arguments: List[String], val settings: Settings, + error: String => unit, interactive: boolean) { + private var fs: List[String] = List() /** All files to compile */ def files: List[String] = fs.reverse - /** The applicable settings */ - val settings: Settings = new Settings(error) - /** The name of the command */ val cmdName = "scalac" diff --git a/src/compiler/scala/tools/nsc/InterpreterCommand.scala b/src/compiler/scala/tools/nsc/InterpreterCommand.scala index 4d20b4ab7..308fe1986 100644 --- a/src/compiler/scala/tools/nsc/InterpreterCommand.scala +++ b/src/compiler/scala/tools/nsc/InterpreterCommand.scala @@ -2,13 +2,13 @@ * Copyright 2005-2006 LAMP/EPFL * @author Martin Odersky */ -// $Id: $ +// $Id$ package scala.tools.nsc /** a command line for the interpreter */ class InterpreterCommand(arguments: List[String], error: String => unit) -extends CompilerCommand(arguments, error, false) { +extends CompilerCommand(arguments, new Settings(error), error, false) { override val cmdName = "scala" override val fileEnding = ".scalaint" } diff --git a/src/compiler/scala/tools/nsc/Main.scala b/src/compiler/scala/tools/nsc/Main.scala index 5c4c52e2f..82a0026c2 100644 --- a/src/compiler/scala/tools/nsc/Main.scala +++ b/src/compiler/scala/tools/nsc/Main.scala @@ -33,13 +33,14 @@ object Main extends AnyRef with EvalLoop { def resident(compiler: Global): unit = loop { line => val args = List.fromString(line, ' ') - val command = new CompilerCommand(args, error, true) + val command = new CompilerCommand(args, new Settings(error), error, true) (new compiler.Run) compile command.files } def process(args: Array[String]): unit = { - val command = new CompilerCommand(List.fromArray(args), error, false) - reporter = new ConsoleReporter(command.settings) + val settings = new Settings(error) + reporter = new ConsoleReporter(settings) + val command = new CompilerCommand(List.fromArray(args), settings, error, false) if (command.settings.version.value) reporter.info(null, versionMsg, true) else if (command.settings.help.value) diff --git a/src/compiler/scala/tools/nsc/MainTokenMetric.scala b/src/compiler/scala/tools/nsc/MainTokenMetric.scala index 798f43140..e1a0e6f90 100644 --- a/src/compiler/scala/tools/nsc/MainTokenMetric.scala +++ b/src/compiler/scala/tools/nsc/MainTokenMetric.scala @@ -41,8 +41,9 @@ object MainTokenMetric { } def process(args: Array[String]): unit = { - val command = new CompilerCommand(List.fromArray(args), error, false) - reporter = new ConsoleReporter(command.settings) + val settings = new Settings(error) + reporter = new ConsoleReporter(settings) + val command = new CompilerCommand(List.fromArray(args), settings, error, false) try { val compiler = new Global(command.settings, reporter) tokenMetric(compiler, command.files)