@@ -80,15 +80,13 @@ class CompilingInterpreter(out: PrintWriter, ictx: Context) extends Compiler wit
80
80
private var printResults : Boolean = true
81
81
private var delayOutput : Boolean = false
82
82
83
- var previousOutput : String = null
84
-
85
- override def lastOutput () =
86
- if (previousOutput == null ) None
87
- else {
88
- val ret = Some (previousOutput)
89
- previousOutput = null
90
- ret
91
- }
83
+ var previousOutput : List [String ] = Nil
84
+
85
+ override def lastOutput () = {
86
+ val prev = previousOutput
87
+ previousOutput = Nil
88
+ prev
89
+ }
92
90
93
91
override def delayOutputDuring [T ](operation : => T ): T = {
94
92
val old = delayOutput
@@ -113,14 +111,18 @@ class CompilingInterpreter(out: PrintWriter, ictx: Context) extends Compiler wit
113
111
114
112
private def newReporter = new ConsoleReporter (Console .in, out) {
115
113
override def printMessage (msg : String ) = {
116
- out.print(/* clean*/ (msg) + " \n " )
117
- // Suppress clean for now for compiler messages
118
- // Otherwise we will completely delete all references to
119
- // line$object$ module classes. The previous interpreter did not
120
- // have the project because the module class was written without the final `$'
121
- // and therefore escaped the purge. We can turn this back on once
122
- // we drop the final `$' from module classes.
123
- out.flush()
114
+ if (! delayOutput) {
115
+ out.print(/* clean*/ (msg) + " \n " )
116
+ // Suppress clean for now for compiler messages
117
+ // Otherwise we will completely delete all references to
118
+ // line$object$ module classes. The previous interpreter did not
119
+ // have the project because the module class was written without the final `$'
120
+ // and therefore escaped the purge. We can turn this back on once
121
+ // we drop the final `$' from module classes.
122
+ out.flush()
123
+ } else {
124
+ previousOutput = (/* clean*/ (msg) + " \n " ) :: previousOutput
125
+ }
124
126
}
125
127
}
126
128
@@ -210,7 +212,7 @@ class CompilingInterpreter(out: PrintWriter, ictx: Context) extends Compiler wit
210
212
else {
211
213
val (interpreterResultString, succeeded) = req.loadAndRun()
212
214
if (delayOutput)
213
- previousOutput = clean(interpreterResultString)
215
+ previousOutput = clean(interpreterResultString) :: previousOutput
214
216
else if (printResults || ! succeeded)
215
217
out.print(clean(interpreterResultString))
216
218
if (succeeded) {
0 commit comments