Fixed bug #953
git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@10038 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
This commit is contained in:
parent
c728a843c6
commit
fbe9a722b0
|
@ -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)
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue