summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2011-08-23 23:41:12 +0000
committerPaul Phillips <paulp@improving.org>2011-08-23 23:41:12 +0000
commit24a821b57519f711f759928ff99423e30ed24a3d (patch)
tree19b6007bb15dd53fa548c5411a301cf8b831a907
parent6ffea90982464bcbd08c5f4df55a0408215f7353 (diff)
downloadscala-24a821b57519f711f759928ff99423e30ed24a3d.tar.gz
scala-24a821b57519f711f759928ff99423e30ed24a3d.tar.bz2
scala-24a821b57519f711f759928ff99423e30ed24a3d.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.
-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 e78af9fb67..d6ef04dbc1 100644
--- a/src/compiler/scala/tools/nsc/interpreter/IMain.scala
+++ b/src/compiler/scala/tools/nsc/interpreter/IMain.scala
@@ -237,7 +237,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) = {
@@ -909,6 +910,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")