summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeoffrey Washburn <geoffrey.washburn@epfl.ch>2008-09-01 11:55:15 +0000
committerGeoffrey Washburn <geoffrey.washburn@epfl.ch>2008-09-01 11:55:15 +0000
commitcd085f614377eeef6f9ac87fc11bd776e514e7fd (patch)
tree71091a222308851f2da3dcc9f267f8fd6bfdbbcb /src
parentf58162a784e46916d85ad9dbec063143ecf8211e (diff)
downloadscala-cd085f614377eeef6f9ac87fc11bd776e514e7fd.tar.gz
scala-cd085f614377eeef6f9ac87fc11bd776e514e7fd.tar.bz2
scala-cd085f614377eeef6f9ac87fc11bd776e514e7fd.zip
Small change to the code generated by the inter...
Small change to the code generated by the interperter not to call toString on the result twice. Probably not much of a concern in terms of efficiency, but useful if toString is effectful.
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/Interpreter.scala7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/Interpreter.scala b/src/compiler/scala/tools/nsc/Interpreter.scala
index 1fbc80ab82..99606e856f 100644
--- a/src/compiler/scala/tools/nsc/Interpreter.scala
+++ b/src/compiler/scala/tools/nsc/Interpreter.scala
@@ -625,11 +625,10 @@ class Interpreter(val settings: Settings, out: PrintWriter) {
" (if(" +
req.fullPath(vname) +
".asInstanceOf[AnyRef] != null) " +
- " ((if(" +
+ " { val tmp = " +
req.fullPath(vname) +
- ".toString().contains('\\n')) " +
- " \"\\n\" else \"\") + " +
- req.fullPath(vname) + ".toString() + \"\\n\") else \"null\\n\") ")
+ ".toString(); " +
+ " (if(tmp.contains('\\n')) \"\\n\" else \"\") + tmp + \"\\n\"} else \"null\\n\") ")
}
}
}