aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorodersky <odersky@gmail.com>2016-07-27 23:29:28 +0200
committerGitHub <noreply@github.com>2016-07-27 23:29:28 +0200
commit48d6460865f4b83e6df42551ce55319805ad7342 (patch)
treedd65e87ca1b19418452e2c0e1e38a96b7d98b650 /src
parente0d34de9ce760ad4973819de162e6bad64710b14 (diff)
parentbc07944a62102765c1bbdc35dae4f19f3bfd9c8d (diff)
downloaddotty-48d6460865f4b83e6df42551ce55319805ad7342.tar.gz
dotty-48d6460865f4b83e6df42551ce55319805ad7342.tar.bz2
dotty-48d6460865f4b83e6df42551ce55319805ad7342.zip
Merge pull request #1421 from cswinter/repl-inversion-fix
Fix #1411: Give REPL output in correct order
Diffstat (limited to 'src')
-rw-r--r--src/dotty/tools/dotc/repl/CompilingInterpreter.scala10
-rw-r--r--src/dotty/tools/dotc/repl/Interpreter.scala2
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]
}