From ccc671bed8ee57542652e5c79ef556452784b2cd Mon Sep 17 00:00:00 2001 From: Reto Hablützel Date: Tue, 15 Nov 2016 07:06:17 +0100 Subject: Add colon after method type, prefix def/val/var in REPL --- compiler/src/dotty/tools/dotc/repl/CompilingInterpreter.scala | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'compiler/src/dotty/tools/dotc/repl') diff --git a/compiler/src/dotty/tools/dotc/repl/CompilingInterpreter.scala b/compiler/src/dotty/tools/dotc/repl/CompilingInterpreter.scala index 5b3669d5e..84b7199f4 100644 --- a/compiler/src/dotty/tools/dotc/repl/CompilingInterpreter.scala +++ b/compiler/src/dotty/tools/dotc/repl/CompilingInterpreter.scala @@ -685,7 +685,12 @@ class CompilingInterpreter( val varType = string2code(req.typeOf(varName)) val fullPath = req.fullPath(varName) - s""" + "$prettyName: $varType = " + { + val varOrVal = statement match { + case v: ValDef if v.mods is Flags.Mutable => "var" + case _ => "val" + } + + s""" + "$varOrVal $prettyName: $varType = " + { | if ($fullPath.asInstanceOf[AnyRef] != null) { | (if ($fullPath.toString().contains('\\n')) "\\n" else "") + | $fullPath.toString() + "\\n" @@ -736,7 +741,7 @@ class CompilingInterpreter( override def resultExtractionCode(req: Request, code: PrintWriter): Unit = { if (!defDef.mods.is(Flags.AccessFlags)) - code.print("+\"" + string2code(defDef.name.toString) + ": " + + code.print("+\"def " + string2code(defDef.name.toString) + string2code(req.typeOf(defDef.name)) + "\\n\"") } } -- cgit v1.2.3