diff options
author | Clemens Winter <clemenswinter1@gmail.com> | 2016-07-27 16:51:03 +0200 |
---|---|---|
committer | Clemens Winter <clemenswinter1@gmail.com> | 2016-07-27 17:29:42 +0200 |
commit | bc07944a62102765c1bbdc35dae4f19f3bfd9c8d (patch) | |
tree | b41b1dde92ca007db3d62634b2681b564cb166a5 /src | |
parent | 5ffce6e910f4cc1fced15824df86a9524be81681 (diff) | |
download | dotty-bc07944a62102765c1bbdc35dae4f19f3bfd9c8d.tar.gz dotty-bc07944a62102765c1bbdc35dae4f19f3bfd9c8d.tar.bz2 dotty-bc07944a62102765c1bbdc35dae4f19f3bfd9c8d.zip |
Fix #1411: Give REPL output in correct order
Diffstat (limited to 'src')
-rw-r--r-- | src/dotty/tools/dotc/repl/CompilingInterpreter.scala | 10 | ||||
-rw-r--r-- | src/dotty/tools/dotc/repl/Interpreter.scala | 2 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/dotty/tools/dotc/repl/CompilingInterpreter.scala b/src/dotty/tools/dotc/repl/CompilingInterpreter.scala index 897011be2..9750c9039 100644 --- a/src/dotty/tools/dotc/repl/CompilingInterpreter.scala +++ b/src/dotty/tools/dotc/repl/CompilingInterpreter.scala @@ -88,11 +88,11 @@ class CompilingInterpreter( private var printResults: Boolean = true private var delayOutput: Boolean = false - var previousOutput: List[String] = Nil + val previousOutput = ListBuffer.empty[String] override def lastOutput() = { - val prev = previousOutput - previousOutput = Nil + val prev = previousOutput.toList + previousOutput.clear() prev } @@ -129,7 +129,7 @@ class CompilingInterpreter( // we drop the final `$' from module classes. out.flush() } else { - previousOutput = (/*clean*/(msg) + "\n") :: previousOutput + previousOutput += (/*clean*/(msg) + "\n") } } } @@ -220,7 +220,7 @@ class CompilingInterpreter( else { val (resultStrings, succeeded) = req.loadAndRun() if (delayOutput) - previousOutput = resultStrings.map(clean) ::: previousOutput + previousOutput ++= resultStrings.map(clean) else if (printResults || !succeeded) resultStrings.map(x => out.print(clean(x))) if (succeeded) { diff --git a/src/dotty/tools/dotc/repl/Interpreter.scala b/src/dotty/tools/dotc/repl/Interpreter.scala index e11fbf5cc..edcc5b153 100644 --- a/src/dotty/tools/dotc/repl/Interpreter.scala +++ b/src/dotty/tools/dotc/repl/Interpreter.scala @@ -41,5 +41,5 @@ trait Interpreter { def delayOutputDuring[T](operation: => T): T /** Gets the last output not printed immediately */ - def lastOutput(): List[String] + def lastOutput(): Seq[String] } |