aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/dotty/tools/dotc/repl/InterpreterLoop.scala23
1 files changed, 7 insertions, 16 deletions
diff --git a/src/dotty/tools/dotc/repl/InterpreterLoop.scala b/src/dotty/tools/dotc/repl/InterpreterLoop.scala
index 7e5dcc7f1..8b1000f2e 100644
--- a/src/dotty/tools/dotc/repl/InterpreterLoop.scala
+++ b/src/dotty/tools/dotc/repl/InterpreterLoop.scala
@@ -83,25 +83,16 @@ class InterpreterLoop(compiler: Compiler, config: REPL.Config)(implicit ctx: Con
/** interpret all lines from a specified file */
def interpretAllFrom(filename: String): Unit = {
- val fileIn = try {
- new FileReader(filename)
- } catch {
- case _: IOException =>
- output.println("Error opening file: " + filename)
- return
- }
- val oldIn = in
- val oldReplay = replayCommandsRev
+ import java.nio.file.{Files, Paths}
+ import scala.collection.JavaConversions._
try {
- val inFile = new BufferedReader(fileIn)
- in = new SimpleReader(inFile, output, false)
+ val lines = Files.readAllLines(Paths.get(filename)).mkString("\n")
output.println("Loading " + filename + "...")
output.flush
- repl()
- } finally {
- in = oldIn
- replayCommandsRev = oldReplay
- fileIn.close
+ interpreter.interpret(lines)
+ } catch {
+ case _: IOException =>
+ output.println("Error opening file: " + filename)
}
}