summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/compiler/scala/tools/nsc/Interpreter.scala15
-rw-r--r--src/compiler/scala/tools/nsc/interpreter/package.scala8
2 files changed, 12 insertions, 11 deletions
diff --git a/src/compiler/scala/tools/nsc/Interpreter.scala b/src/compiler/scala/tools/nsc/Interpreter.scala
index 74d37bd31e..743ffefcd0 100644
--- a/src/compiler/scala/tools/nsc/Interpreter.scala
+++ b/src/compiler/scala/tools/nsc/Interpreter.scala
@@ -173,16 +173,6 @@ class Interpreter(val settings: Settings, out: PrintWriter) {
/** interpreter settings */
lazy val isettings = new InterpreterSettings(this)
- /** Heuristically strip interpreter wrapper prefixes
- * from an interpreter output string.
- */
- def stripWrapperGunk(str: String): String =
- if (isettings.unwrapStrings) {
- val wrapregex = """(line[0-9]+\$object[$.])?(\$iw[$.])*"""
- str.replaceAll(wrapregex, "")
- }
- else str
-
/** Instantiate a compiler. Subclasses can override this to
* change the compiler class used by this interpreter. */
protected def newCompiler(settings: Settings, reporter: Reporter) = {
@@ -341,7 +331,10 @@ class Interpreter(val settings: Settings, out: PrintWriter) {
}
/** Clean up a string for output */
- private def clean(str: String) = truncPrintString(stripWrapperGunk(str))
+ private def clean(str: String) = truncPrintString(
+ if (isettings.unwrapStrings) stripWrapperGunk(str)
+ else str
+ )
/** Indent some code by the width of the scala> prompt.
* This way, compiler error messages read better.
diff --git a/src/compiler/scala/tools/nsc/interpreter/package.scala b/src/compiler/scala/tools/nsc/interpreter/package.scala
index 2ded3a7900..ab2860ac8e 100644
--- a/src/compiler/scala/tools/nsc/interpreter/package.scala
+++ b/src/compiler/scala/tools/nsc/interpreter/package.scala
@@ -18,6 +18,14 @@ package object interpreter {
/** null becomes "", otherwise identity */
def onull(s: String) = if (s == null) "" else s
+ /** Heuristically strip interpreter wrapper prefixes
+ * from an interpreter output string.
+ */
+ def stripWrapperGunk(str: String): String = {
+ val wrapregex = """(line[0-9]+\$object[$.])?(\$iw[$.])*"""
+ str.replaceAll(wrapregex, "")
+ }
+
/** Class objects */
def classForName(name: String): Option[Class[_]] =
try Some(Class forName name)