summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLex Spoon <lex@lexspoon.org>2007-07-02 00:30:57 +0000
committerLex Spoon <lex@lexspoon.org>2007-07-02 00:30:57 +0000
commit665a2748f0c2480b470eb9f938d48232b2af1097 (patch)
tree6f975d57ea66fd3be78527d0c38334f039e62804 /src
parentfed30dbea8626d29c39d8f88d100b63ceb0173d6 (diff)
downloadscala-665a2748f0c2480b470eb9f938d48232b2af1097.tar.gz
scala-665a2748f0c2480b470eb9f938d48232b2af1097.tar.bz2
scala-665a2748f0c2480b470eb9f938d48232b2af1097.zip
tweak to printed output: do not print any extra...
tweak to printed output: do not print any extra information if the request is a simple expression of type Unit
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/Interpreter.scala13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/Interpreter.scala b/src/compiler/scala/tools/nsc/Interpreter.scala
index fd58a9ad71..1aef6d0742 100644
--- a/src/compiler/scala/tools/nsc/Interpreter.scala
+++ b/src/compiler/scala/tools/nsc/Interpreter.scala
@@ -619,6 +619,10 @@ class Interpreter(val settings: Settings, out: PrintWriter) {
* the request binds. */
val accessPath = myImportsCode._3
+
+ /** Code to access a variable with the specified name */
+ def fullPath(vname: String) = objectName + accessPath + "." + vname
+
/** the line of code to compute */
def toCompute = line
@@ -780,8 +784,7 @@ class Interpreter(val settings: Settings, out: PrintWriter) {
/** Print out lhs instead of the generated varName */
override def resultExtractionCode(code: PrintWriter) {
code.print(" + \"" + lhs + ": " + typeOf(compiler.encode(varName)) +
- " = \" + " + objectName + accessPath +
- "." + varName + " + \"\\n\"")
+ " = \" + " + fullPath(varName) + " + \"\\n\"")
}
}
@@ -789,6 +792,12 @@ class Interpreter(val settings: Settings, out: PrintWriter) {
private class ExprReq(line: String, lineName: String)
extends Request(line, lineName) {
override val needsVarName = true
+
+ /** Skip the printout if the expression has type Unit */
+ override def resultExtractionCode(code: PrintWriter) {
+ if (typeOf(compiler.encode(varName)) != "Unit")
+ super.resultExtractionCode(code)
+ }
}
/** A module definition */