summaryrefslogtreecommitdiff
path: root/src/compiler/scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2011-08-08 07:25:47 +0000
committerPaul Phillips <paulp@improving.org>2011-08-08 07:25:47 +0000
commit9e4bdd411cbc3db5064dcd01a9c35bd46508ceb4 (patch)
tree68010973dcbb19f6bef0fade42b607805158804f /src/compiler/scala
parent5b11f250ce650b8c66134e6ae6a9f48b3c82f64a (diff)
downloadscala-9e4bdd411cbc3db5064dcd01a9c35bd46508ceb4.tar.gz
scala-9e4bdd411cbc3db5064dcd01a9c35bd46508ceb4.tar.bz2
scala-9e4bdd411cbc3db5064dcd01a9c35bd46508ceb4.zip
Made the thread behavior of the repl a little b...
Made the thread behavior of the repl a little bit configurable. Every line will run in the same thread: scala -Dscala.repl.no-threads This mechanism is likely to change. Repl is obscenely overdue for a config file. No review.
Diffstat (limited to 'src/compiler/scala')
-rw-r--r--src/compiler/scala/tools/nsc/interpreter/IMain.scala7
-rw-r--r--src/compiler/scala/tools/nsc/interpreter/ReplProps.scala1
2 files changed, 7 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/interpreter/IMain.scala b/src/compiler/scala/tools/nsc/interpreter/IMain.scala
index 207def1eb2..3abcb3e416 100644
--- a/src/compiler/scala/tools/nsc/interpreter/IMain.scala
+++ b/src/compiler/scala/tools/nsc/interpreter/IMain.scala
@@ -240,7 +240,8 @@ class IMain(val settings: Settings, protected val out: JPrintWriter) extends Imp
lazy val isettings = new ISettings(this)
/** Create a line manager. Overridable. */
- protected def createLineManager(): Line.Manager = new Line.Manager
+ protected def createLineManager(): Line.Manager =
+ if (replProps.noThreads) null else new Line.Manager
/** Instantiate a compiler. Overridable. */
protected def newCompiler(settings: Settings, reporter: Reporter) = {
@@ -912,6 +913,10 @@ class IMain(val settings: Settings, protected val out: JPrintWriter) extends Imp
/** load and run the code using reflection */
def loadAndRun: (String, Boolean) = {
+ if (replProps.noThreads) return {
+ try { ("" + (lineRep call sessionNames.print), true) }
+ catch { case ex => (lineRep.bindError(ex), false) }
+ }
import interpreter.Line._
try {
diff --git a/src/compiler/scala/tools/nsc/interpreter/ReplProps.scala b/src/compiler/scala/tools/nsc/interpreter/ReplProps.scala
index 5eb1e0ae18..72bfb2eeff 100644
--- a/src/compiler/scala/tools/nsc/interpreter/ReplProps.scala
+++ b/src/compiler/scala/tools/nsc/interpreter/ReplProps.scala
@@ -13,6 +13,7 @@ class ReplProps {
val jlineDebug = bool("scala.tools.jline.internal.Log.debug")
val jlineTrace = bool("scala.tools.jline.internal.Log.trace")
+ val noThreads = bool("scala.repl.no-threads")
val info = bool("scala.repl.info")
val debug = bool("scala.repl.debug")