summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLex Spoon <lex@lexspoon.org>2007-07-22 17:01:15 +0000
committerLex Spoon <lex@lexspoon.org>2007-07-22 17:01:15 +0000
commitd5d4f71448c03b3179c56a841433f1f5e4a40a03 (patch)
tree7d7fe677f3beb6f7cf11ed3f88268b4f9160f400
parenta41f6eefc591876f5bf27b7eff5a5cd45e93a4b6 (diff)
downloadscala-d5d4f71448c03b3179c56a841433f1f5e4a40a03.tar.gz
scala-d5d4f71448c03b3179c56a841433f1f5e4a40a03.tar.bz2
scala-d5d4f71448c03b3179c56a841433f1f5e4a40a03.zip
if the result of an expression includesa newlin...
if the result of an expression includesa newline, then start a new line before printing it out
-rw-r--r--src/compiler/scala/tools/nsc/Interpreter.scala13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/Interpreter.scala b/src/compiler/scala/tools/nsc/Interpreter.scala
index 0e3dcca570..9f0b6ce7ab 100644
--- a/src/compiler/scala/tools/nsc/Interpreter.scala
+++ b/src/compiler/scala/tools/nsc/Interpreter.scala
@@ -634,7 +634,11 @@ class Interpreter(val settings: Settings, out: PrintWriter) {
/** Code to access a variable with the specified name */
- def fullPath(vname: String) = objectName + accessPath + "." + vname
+ def fullPath(vname: String): String =
+ objectName + accessPath + "." + vname
+
+ /** Code to access a variable with the specified name */
+ def fullPath(vname: Name): String = fullPath(vname.toString)
/** the line of code to compute */
def toCompute = line
@@ -681,9 +685,10 @@ class Interpreter(val settings: Settings, out: PrintWriter) {
def resultExtractionCode(code: PrintWriter): Unit =
for (vname <- valAndVarNames) {
- code.print(" + \"" + vname + ": " + typeOf(vname) +
- " = \" + " + objectName + accessPath +
- "." + vname + " + \"\\n\"")
+ code.print(" + \"" + vname + ": " + typeOf(vname) + " = \" + " +
+ " (if(" + fullPath(vname) + ".toString.contains('\\n')) " +
+ " \"\\n\" else \"\") + " +
+ fullPath(vname) + " + \"\\n\"")
}
/** Compile the object file. Returns whether the compilation succeeded.