diff options
author | Som Snytt <som.snytt@gmail.com> | 2014-03-15 02:14:01 -0700 |
---|---|---|
committer | Som Snytt <som.snytt@gmail.com> | 2014-03-15 02:14:01 -0700 |
commit | 47c03aa5a8fc0d66c28574b6029fa3f150a6a4e9 (patch) | |
tree | 26a0a2df861e244a1e0378a75b5b0e478f567e0d /src/repl/scala/tools/nsc/interpreter/IMain.scala | |
parent | 492624d729730d594097aa618f8f1e34caa79639 (diff) | |
download | scala-47c03aa5a8fc0d66c28574b6029fa3f150a6a4e9.tar.gz scala-47c03aa5a8fc0d66c28574b6029fa3f150a6a4e9.tar.bz2 scala-47c03aa5a8fc0d66c28574b6029fa3f150a6a4e9.zip |
SI-8415 Exception handling in REPL init
Incremental robustness, and probe for typer phase.
The probe would be unnecessary if repl contributed a
terminal phase that "requires" whatever it needs; that
is checked when the Run is built.
Diffstat (limited to 'src/repl/scala/tools/nsc/interpreter/IMain.scala')
-rw-r--r-- | src/repl/scala/tools/nsc/interpreter/IMain.scala | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/repl/scala/tools/nsc/interpreter/IMain.scala b/src/repl/scala/tools/nsc/interpreter/IMain.scala index 9c853fb514..47d97dd4dd 100644 --- a/src/repl/scala/tools/nsc/interpreter/IMain.scala +++ b/src/repl/scala/tools/nsc/interpreter/IMain.scala @@ -117,8 +117,10 @@ class IMain(@BeanProperty val factory: ScriptEngineFactory, initialSettings: Set private def _initSources = List(new BatchSourceFile("<init>", "class $repl_$init { }")) private def _initialize() = { try { - // todo. if this crashes, REPL will hang - new _compiler.Run() compileSources _initSources + // if this crashes, REPL will hang its head in shame + val run = new _compiler.Run() + assert(run.typerPhase != NoPhase, "REPL requires a typer phase.") + run compileSources _initSources _initializeComplete = true true } @@ -384,6 +386,7 @@ class IMain(@BeanProperty val factory: ScriptEngineFactory, initialSettings: Set def compileSourcesKeepingRun(sources: SourceFile*) = { val run = new Run() + assert(run.typerPhase != NoPhase, "REPL requires a typer phase.") reporter.reset() run compileSources sources.toList (!reporter.hasErrors, run) |