summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2011-04-27 18:36:16 +0000
committerPaul Phillips <paulp@improving.org>2011-04-27 18:36:16 +0000
commit45f20c26c94ec934872fd0a55ca07c77ed9a2169 (patch)
tree24b273d313eaca61e340a969dc699e98966b08e1
parent6a988aeff0f426480ce50ebfbe0dcb50c3f4753a (diff)
downloadscala-45f20c26c94ec934872fd0a55ca07c77ed9a2169.tar.gz
scala-45f20c26c94ec934872fd0a55ca07c77ed9a2169.tar.bz2
scala-45f20c26c94ec934872fd0a55ca07c77ed9a2169.zip
A little cleanup on a repl command, no review.
-rw-r--r--src/compiler/scala/tools/nsc/interpreter/ILoop.scala15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/interpreter/ILoop.scala b/src/compiler/scala/tools/nsc/interpreter/ILoop.scala
index fbb3457f4d..b4b2f097d2 100644
--- a/src/compiler/scala/tools/nsc/interpreter/ILoop.scala
+++ b/src/compiler/scala/tools/nsc/interpreter/ILoop.scala
@@ -268,6 +268,7 @@ class ILoop(in0: Option[BufferedReader], protected val out: PrintWriter)
cmd("phase", "<phase>", "set the implicit phase for power commands", phaseCommand),
cmd("wrap", "<method>", "name of method to wrap around each repl line", wrapCommand) withLongHelp ("""
|:wrap
+ |:wrap clear
|:wrap <method>
|
|Installs a wrapper around each line entered into the repl.
@@ -281,7 +282,8 @@ class ILoop(in0: Option[BufferedReader], protected val out: PrintWriter)
|}
|:wrap timed
|
- |If given no argument, :wrap removes any wrapper present.
+ |If given no argument, :wrap names the wrapper installed.
+ |An argument of clear will remove the wrapper if any is active.
|Note that wrappers do not compose (a new one replaces the old
|one) and also that the :phase command uses the same machinery,
|so setting :wrap will clear any :phase setting.
@@ -436,8 +438,15 @@ class ILoop(in0: Option[BufferedReader], protected val out: PrintWriter)
words(line) match {
case Nil =>
- intp setExecutionWrapper ""
- "Cleared wrapper."
+ intp.executionWrapper match {
+ case "" => "No execution wrapper is set."
+ case s => "Current execution wrapper: " + s
+ }
+ case "clear" :: Nil =>
+ intp.executionWrapper match {
+ case "" => "No execution wrapper is set."
+ case s => intp.clearExecutionWrapper() ; "Cleared execution wrapper."
+ }
case wrapper :: Nil =>
intp.typeOfExpression(wrapper) match {
case Some(PolyType(List(targ), MethodType(List(arg), restpe))) =>