diff options
author | Paul Phillips <paulp@improving.org> | 2009-10-03 17:17:35 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2009-10-03 17:17:35 +0000 |
commit | aad82c0521ebf08b759b3080a56451be435c02b3 (patch) | |
tree | a02e10b948eeaab0704242b6f5feb8e8ecfb288d /src | |
parent | 5d0b9775ab16b23bf781ab62f9c124895e771906 (diff) | |
download | scala-aad82c0521ebf08b759b3080a56451be435c02b3.tar.gz scala-aad82c0521ebf08b759b3080a56451be435c02b3.tar.bz2 scala-aad82c0521ebf08b759b3080a56451be435c02b3.zip |
Enhanced the previous string length fix to work...
Enhanced the previous string length fix to work, and made it possible to
enable/disable deprecation warnings on the fly in the repl, like so:
settings.deprecation = true
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/Interpreter.scala | 2 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/InterpreterSettings.scala | 22 |
2 files changed, 20 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/Interpreter.scala b/src/compiler/scala/tools/nsc/Interpreter.scala index d34c4a8640..48cc5bc61b 100644 --- a/src/compiler/scala/tools/nsc/Interpreter.scala +++ b/src/compiler/scala/tools/nsc/Interpreter.scala @@ -102,7 +102,7 @@ class Interpreter(val settings: Settings, out: PrintWriter) } /** interpreter settings */ - lazy val isettings = new InterpreterSettings + lazy val isettings = new InterpreterSettings(this) object reporter extends ConsoleReporter(settings, null, out) { override def printMessage(msg: String) { diff --git a/src/compiler/scala/tools/nsc/InterpreterSettings.scala b/src/compiler/scala/tools/nsc/InterpreterSettings.scala index 8675e3d8bd..e274294082 100644 --- a/src/compiler/scala/tools/nsc/InterpreterSettings.scala +++ b/src/compiler/scala/tools/nsc/InterpreterSettings.scala @@ -11,7 +11,7 @@ package scala.tools.nsc * @version 1.0 * @author Lex Spoon, 2007/3/24 **/ -class InterpreterSettings { +class InterpreterSettings(repl: Interpreter) { /** A list of paths where :load should look */ var loadPath = List(".") @@ -22,6 +22,14 @@ class InterpreterSettings { */ var maxPrintString = 2400 + def deprecation_=(x: Boolean) = { + val old = repl.settings.deprecation.value + repl.settings.deprecation.value = x + if (!old && x) println("Enabled -deprecation output.") + else if (old && !x) println("Disabled -deprecation output.") + } + def deprecation: Boolean = repl.settings.deprecation.value + override def toString = "InterpreterSettings {\n" + // " loadPath = " + loadPath + "\n" + @@ -50,7 +58,7 @@ package scala.tools.nsc * @version 1.0 * @author Lex Spoon, 2007/3/24 **/ -class InterpreterSettings { +class InterpreterSettings(repl: Interpreter) { /** A list of paths where :load should look */ var loadPath = List(".") @@ -59,7 +67,15 @@ class InterpreterSettings { * more than this number of characters, then the printout is * truncated. */ - var maxPrintString = 390 + var maxPrintString = 2400 + + def deprecation_=(x: Boolean) = { + val old = repl.settings.deprecation.value + repl.settings.deprecation.value = x + if (!old && x) println("Enabled -deprecation output.") + else if (old && !x) println("Disabled -deprecation output.") + } + def deprecation: Boolean = repl.settings.deprecation.value override def toString = "InterpreterSettings {\n" + |