@@ -13,22 +13,27 @@ import dotty.tools.dotc.printing.Texts._
13
13
14
14
class ReplPrinter (_ctx : Context ) extends DecompilerPrinter (_ctx) {
15
15
16
+ val debugPrint = _ctx.settings.YprintDebug .value
17
+
16
18
override def nameString (name : Name ): String =
17
19
if (name.isReplAssignName) name.decode.toString.takeWhile(_ != '$' )
18
20
else super .nameString(name)
19
21
20
22
override protected def exprToText (tp : ExprType ): Text =
21
- " : " ~ toText(tp.resType)
23
+ if (debugPrint) super .exprToText(tp)
24
+ else " : " ~ toText(tp.resType)
22
25
23
26
override def toText (sym : Symbol ): Text =
24
27
if (sym.name.isReplAssignName) nameString(sym.name)
28
+ else if (debugPrint) super .toText(sym)
25
29
else keyString(sym) ~~ nameString(sym.name.stripModuleClassSuffix)
26
30
27
31
override def toText (const : Constant ): Text =
28
- if (const.tag == Constants .StringTag ) Str ('"' + const.value.toString + '"' )
32
+ if (debugPrint) super .toText(const)
33
+ else if (const.tag == Constants .StringTag ) Str ('"' + const.value.toString + '"' )
29
34
else Str (const.value.toString)
30
35
31
- override def dclText (sym : Symbol ): Text = {
36
+ override def dclText (sym : Symbol ): Text = if (debugPrint) super .dclText(sym) else {
32
37
(" lazy" : Text ).provided(sym.is(Lazy )) ~~
33
38
toText(sym) ~ {
34
39
if (sym.is(Method )) toText(sym.info)
@@ -38,10 +43,14 @@ class ReplPrinter(_ctx: Context) extends DecompilerPrinter(_ctx) {
38
43
}
39
44
}
40
45
41
- override def toTextSingleton (tp : SingletonType ): Text = tp match {
42
- case ConstantType (const) => toText(const)
43
- case _ => toTextRef(tp) ~ " .type"
44
- }
46
+ override def toTextSingleton (tp : SingletonType ): Text =
47
+ if (debugPrint)
48
+ super .toTextSingleton(tp)
49
+ else
50
+ tp match {
51
+ case ConstantType (const) => toText(const)
52
+ case _ => toTextRef(tp) ~ " .type"
53
+ }
45
54
46
55
// We don't want the colors coming from RefinedPrinter as the REPL uses its
47
56
// own syntax coloring mechanism.
0 commit comments