@@ -68,17 +68,6 @@ class InterpreterLoop(compiler: Compiler, config: REPL.Config)(implicit ctx: Con
68
68
69
69
val version = " .next (pre-alpha)"
70
70
71
- /** The first interpreted command always takes a couple of seconds
72
- * due to classloading. To bridge the gap, we warm up the interpreter
73
- * by letting it interpret a dummy line while waiting for the first
74
- * line of input to be entered.
75
- */
76
- def firstLine (): String = {
77
- interpreter.beQuietDuring(
78
- interpreter.interpret(" val theAnswerToLifeInTheUniverseAndEverything = 21 * 2" ))
79
- in.readLine(prompt)
80
- }
81
-
82
71
/** The main read-eval-print loop for the interpreter. It calls
83
72
* `command()` for each line of input.
84
73
*/
@@ -177,6 +166,10 @@ class InterpreterLoop(compiler: Compiler, config: REPL.Config)(implicit ctx: Con
177
166
(true , shouldReplay)
178
167
}
179
168
169
+ def silentlyRun (cmds : List [String ]): Unit = cmds.foreach { cmd =>
170
+ interpreter.beQuietDuring(interpreter.interpret(cmd))
171
+ }
172
+
180
173
/** Interpret expressions starting with the first line.
181
174
* Read lines until a complete compilation unit is available
182
175
* or until a syntax error has been seen. If a full unit is
@@ -207,7 +200,9 @@ class InterpreterLoop(compiler: Compiler, config: REPL.Config)(implicit ctx: Con
207
200
try {
208
201
if (! ctx.reporter.hasErrors) { // if there are already errors, no sense to continue
209
202
printWelcome()
210
- repl(firstLine())
203
+ silentlyRun(config.initialCommands)
204
+ repl(in.readLine(prompt))
205
+ silentlyRun(config.cleanupCommands)
211
206
}
212
207
} finally {
213
208
closeInterpreter()
0 commit comments