Permalink
Browse files

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.
  • Loading branch information...
xeno-by committed Jun 5, 2012
1 parent c72307f commit ab40558bb53d6058b175e7f25f51470fa286d92e
@@ -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
@@ -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")
}

0 comments on commit ab40558

Please sign in to comment.