diff options
author | Reto Hablützel <rh@nezasa.com> | 2016-11-15 07:06:17 +0100 |
---|---|---|
committer | Felix Mulder <felix.mulder@gmail.com> | 2016-11-24 13:11:15 +0100 |
commit | ccc671bed8ee57542652e5c79ef556452784b2cd (patch) | |
tree | 2879cc200be9fc7336b834430d3dfa7184594d5f /compiler/src/dotty/tools/dotc/repl | |
parent | 3599c243c86ae0a926ef45a435d38b7878dc322f (diff) | |
download | dotty-ccc671bed8ee57542652e5c79ef556452784b2cd.tar.gz dotty-ccc671bed8ee57542652e5c79ef556452784b2cd.tar.bz2 dotty-ccc671bed8ee57542652e5c79ef556452784b2cd.zip |
Add colon after method type, prefix def/val/var in REPL
Diffstat (limited to 'compiler/src/dotty/tools/dotc/repl')
-rw-r--r-- | compiler/src/dotty/tools/dotc/repl/CompilingInterpreter.scala | 9 |
1 files changed, 7 insertions, 2 deletions
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\"") } } |