summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEugene Burmako <xeno.by@gmail.com>2012-06-05 19:41:31 +0200
committerEugene Burmako <xeno.by@gmail.com>2012-06-08 15:23:08 +0200
commitab40558bb53d6058b175e7f25f51470fa286d92e (patch)
tree33cb335ee66af99fbde5784312b54541b64aaa6e /src
parentc72307ffad42f25777e27df68d6147e75d761fce (diff)
downloadscala-ab40558bb53d6058b175e7f25f51470fa286d92e.tar.gz
scala-ab40558bb53d6058b175e7f25f51470fa286d92e.tar.bz2
scala-ab40558bb53d6058b175e7f25f51470fa286d92e.zip
REPL bells and whistles: -Dscala.repl.autoruncode=<JFile>
Useful for the upcoming reflection refactoring. Previously it was more or less okay to type "import scala.reflect.mirror._", but soon we'll have multiple universes and mirrors.
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/interpreter/ILoop.scala7
-rw-r--r--src/compiler/scala/tools/nsc/interpreter/ReplProps.scala7
2 files changed, 11 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/interpreter/ILoop.scala b/src/compiler/scala/tools/nsc/interpreter/ILoop.scala
index d2e62e171e..b1c488d9dd 100644
--- a/src/compiler/scala/tools/nsc/interpreter/ILoop.scala
+++ b/src/compiler/scala/tools/nsc/interpreter/ILoop.scala
@@ -831,6 +831,13 @@ class ILoop(in0: Option[BufferedReader], protected val out: JPrintWriter)
// Bind intp somewhere out of the regular namespace where
// we can get at it in generated code.
addThunk(intp.quietBind("$intp" -> intp))
+ addThunk({
+ import scala.tools.nsc.io._
+ import Properties.userHome
+ import compat.Platform.EOL
+ val autorun = replProps.replAutorunCode.option flatMap (f => io.File(f).safeSlurp())
+ if (autorun.isDefined) intp.quietRun(autorun.get)
+ })
loadFiles(settings)
// it is broken on startup; go ahead and exit
diff --git a/src/compiler/scala/tools/nsc/interpreter/ReplProps.scala b/src/compiler/scala/tools/nsc/interpreter/ReplProps.scala
index 5eb1e0ae18..75d7c8accf 100644
--- a/src/compiler/scala/tools/nsc/interpreter/ReplProps.scala
+++ b/src/compiler/scala/tools/nsc/interpreter/ReplProps.scala
@@ -19,7 +19,8 @@ class ReplProps {
val trace = bool("scala.repl.trace")
val power = bool("scala.repl.power")
- val replInitCode = Prop[JFile]("scala.repl.initcode")
- val powerInitCode = Prop[JFile]("scala.repl.power.initcode")
- val powerBanner = Prop[JFile]("scala.repl.power.banner")
+ val replInitCode = Prop[JFile]("scala.repl.initcode")
+ val replAutorunCode = Prop[JFile]("scala.repl.autoruncode")
+ val powerInitCode = Prop[JFile]("scala.repl.power.initcode")
+ val powerBanner = Prop[JFile]("scala.repl.power.banner")
}