diff options
author | Lex Spoon <lex@lexspoon.org> | 2007-10-10 01:04:07 +0000 |
---|---|---|
committer | Lex Spoon <lex@lexspoon.org> | 2007-10-10 01:04:07 +0000 |
commit | 8090763f46e04d4433bd40ca72616d9479c5091a (patch) | |
tree | 6c1304a303523a662959ee986651b922d11f8460 /src/compiler | |
parent | 9db671d7025142ad9a44ee18d3c3361f3830d7ee (diff) | |
download | scala-8090763f46e04d4433bd40ca72616d9479c5091a.tar.gz scala-8090763f46e04d4433bd40ca72616d9479c5091a.tar.bz2 scala-8090763f46e04d4433bd40ca72616d9479c5091a.zip |
1. Pre-load any files specified with the -i option
2. When replaying a :load, replay the :load itself, not the list of
commands in the loaded file
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/scala/tools/nsc/InterpreterLoop.scala | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/InterpreterLoop.scala b/src/compiler/scala/tools/nsc/InterpreterLoop.scala index 04be5e9e6a..e1a2c80e98 100644 --- a/src/compiler/scala/tools/nsc/InterpreterLoop.scala +++ b/src/compiler/scala/tools/nsc/InterpreterLoop.scala @@ -167,6 +167,7 @@ class InterpreterLoop(in0: Option[BufferedReader], out: PrintWriter) { return } val oldIn = in + val oldReplay = replayCommandsRev try { val inFile = new BufferedReader(fileIn) in = new SimpleReader(inFile, out, false) @@ -175,6 +176,7 @@ class InterpreterLoop(in0: Option[BufferedReader], out: PrintWriter) { repl } finally { in = oldIn + replayCommandsRev = oldReplay fileIn.close } } @@ -260,6 +262,20 @@ class InterpreterLoop(in0: Option[BufferedReader], out: PrintWriter) { } } + def loadFiles(settings: Settings) { + settings match { + case settings: GenericRunnerSettings => + for (filename <- settings.loadfiles.value) { + val cmd = ":load " + filename + command(cmd) + replayCommandsRev = cmd :: replayCommandsRev + out.println() + } + case _ => + } + } + + def main(settings: Settings) { this.settings = settings @@ -281,6 +297,8 @@ class InterpreterLoop(in0: Option[BufferedReader], out: PrintWriter) { createInterpreter() + loadFiles(settings) + try { if (interpreter.reporter.hasErrors) { return // it is broken on startup; go ahead and exit |