diff options
author | Paul Phillips <paulp@improving.org> | 2011-02-20 00:11:39 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2011-02-20 00:11:39 +0000 |
commit | 1b6f1d4d300bf574f3853fabf9e7bb9590d5ddbc (patch) | |
tree | 7ddb63e796a2840e13d24d9d5120cf88f2a2b321 /src/compiler | |
parent | 801c5cd82e1a7feb1f9515785ad36e0f0d2b993e (diff) | |
download | scala-1b6f1d4d300bf574f3853fabf9e7bb9590d5ddbc.tar.gz scala-1b6f1d4d300bf574f3853fabf9e7bb9590d5ddbc.tar.bz2 scala-1b6f1d4d300bf574f3853fabf9e7bb9590d5ddbc.zip |
Hid repl value rebinding behind power mode.
Diffstat (limited to 'src/compiler')
4 files changed, 13 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/interpreter/ConsoleReaderHelper.scala b/src/compiler/scala/tools/nsc/interpreter/ConsoleReaderHelper.scala index d0d3349038..a775fca92c 100644 --- a/src/compiler/scala/tools/nsc/interpreter/ConsoleReaderHelper.scala +++ b/src/compiler/scala/tools/nsc/interpreter/ConsoleReaderHelper.scala @@ -48,6 +48,9 @@ trait ConsoleReaderHelper extends ConsoleReader { printColumns(items: List[String]) def printColumns(items: List[String]): Unit = { + if (items forall (_ == "")) + return + val longest = items map (_.length) max var linesLeft = if (isPaginationEnabled()) height - 1 else Int.MaxValue val columnSize = longest + marginSize diff --git a/src/compiler/scala/tools/nsc/interpreter/ILoop.scala b/src/compiler/scala/tools/nsc/interpreter/ILoop.scala index 6a512f3a92..71224b3016 100644 --- a/src/compiler/scala/tools/nsc/interpreter/ILoop.scala +++ b/src/compiler/scala/tools/nsc/interpreter/ILoop.scala @@ -526,6 +526,7 @@ class ILoop(in0: Option[BufferedReader], protected val out: PrintWriter) return "Already in power mode." power = new Power(this) + isReplPower = true power.unleash() power.banner } @@ -781,7 +782,7 @@ class ILoop(in0: Option[BufferedReader], protected val out: PrintWriter) // couple seconds saying "wow, it starts so fast!" and by the time // they type a command the compiler is ready to roll. intp.initialize() - if (sys.props contains PowerProperty) { + if (isReplPower) { plushln("Starting in power mode, one moment...\n") powerCmd() } diff --git a/src/compiler/scala/tools/nsc/interpreter/JLineCompletion.scala b/src/compiler/scala/tools/nsc/interpreter/JLineCompletion.scala index dfcdca04f6..796934cd35 100644 --- a/src/compiler/scala/tools/nsc/interpreter/JLineCompletion.scala +++ b/src/compiler/scala/tools/nsc/interpreter/JLineCompletion.scala @@ -156,16 +156,20 @@ class JLineCompletion(val intp: IMain) extends Completion with CompletionOutput override def follow(id: String) = { if (completions(0) contains id) { intp typeOfExpression id map { tpe => - intp runtimeClassAndTypeOfTerm id match { + def default = TypeMemberCompletion(tpe) + + // only rebinding vals in power mode for now. + if (!isReplPower) default + else intp runtimeClassAndTypeOfTerm id match { case Some((clazz, runtimeType)) => val sym = intp.symbolOfTerm(id) if (sym.isStable) { val param = new NamedParam.Untyped(id, intp valueOfTerm id getOrElse null) TypeMemberCompletion(tpe, runtimeType, param) } - else TypeMemberCompletion(tpe) + else default case _ => - TypeMemberCompletion(tpe) + default } } } diff --git a/src/compiler/scala/tools/nsc/interpreter/package.scala b/src/compiler/scala/tools/nsc/interpreter/package.scala index e2e6cb6651..13fb860128 100644 --- a/src/compiler/scala/tools/nsc/interpreter/package.scala +++ b/src/compiler/scala/tools/nsc/interpreter/package.scala @@ -31,6 +31,7 @@ package object interpreter { private[nsc] val TraceProperty = "scala.repl.trace" private[nsc] val PowerProperty = "scala.repl.power" private[nsc] var isReplDebug = sys.props contains DebugProperty // Also set by -Yrepl-debug + private[nsc] var isReplPower = sys.props contains PowerProperty private[nsc] implicit def enrichClass[T](clazz: Class[T]) = new RichClass[T](clazz) private[interpreter] implicit def javaCharSeqCollectionToScala(xs: JCollection[_ <: CharSequence]): List[String] = { |