git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@10038 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
This commit is contained in:
mihaylov 2007-02-19 14:45:51 +00:00
parent c728a843c6
commit fbe9a722b0
5 changed files with 13 additions and 12 deletions

View File

@ -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)

View File

@ -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"

View File

@ -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"
}

View File

@ -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)

View File

@ -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)