diff options
Diffstat (limited to 'src/dotty/tools/dotc/repl/InterpreterLoop.scala')
-rw-r--r-- | src/dotty/tools/dotc/repl/InterpreterLoop.scala | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/src/dotty/tools/dotc/repl/InterpreterLoop.scala b/src/dotty/tools/dotc/repl/InterpreterLoop.scala index 4ac9602e7..64414fec3 100644 --- a/src/dotty/tools/dotc/repl/InterpreterLoop.scala +++ b/src/dotty/tools/dotc/repl/InterpreterLoop.scala @@ -24,10 +24,10 @@ import scala.concurrent.ExecutionContext.Implicits.global class InterpreterLoop(compiler: Compiler, config: REPL.Config)(implicit ctx: Context) { import config._ - private var in = input - val interpreter = compiler.asInstanceOf[Interpreter] + private var in = input(interpreter) + /** The context class loader at the time this object was created */ protected val originalClassLoader = Thread.currentThread.getContextClassLoader @@ -74,10 +74,10 @@ class InterpreterLoop(compiler: Compiler, config: REPL.Config)(implicit ctx: Con * line of input to be entered. */ def firstLine(): String = { - val futLine = Future(in.readLine(prompt)) + val line = in.readLine(prompt) interpreter.beQuietDuring( interpreter.interpret("val theAnswerToLifeInTheUniverseAndEverything = 21 * 2")) - Await.result(futLine, Duration.Inf) + line } /** The main read-eval-print loop for the interpreter. It calls @@ -178,23 +178,11 @@ class InterpreterLoop(compiler: Compiler, config: REPL.Config)(implicit ctx: Con * read, go ahead and interpret it. Return the full string * to be recorded for replay, if any. */ - def interpretStartingWith(code: String): Option[String] = { + def interpretStartingWith(code: String): Option[String] = interpreter.interpret(code) match { case Interpreter.Success => Some(code) - case Interpreter.Error => None - case Interpreter.Incomplete => - if (in.interactive && code.endsWith("\n\n")) { - output.println("You typed two blank lines. Starting a new command.") - None - } else { - val nextLine = in.readLine(continuationPrompt) - if (nextLine == null) - None // end of file - else - interpretStartingWith(code + "\n" + nextLine) - } + case _ => None } - } /* def loadFiles(settings: Settings) { settings match { |