Skip to content

Commit 241bd91

Browse files
committed
Move repl logic to ReplPrinter
1 parent 6f81983 commit 241bd91

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

compiler/src/dotty/tools/dotc/printing/RefinedPrinter.scala

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,7 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
7878
protected val PrintableFlags = (SourceModifierFlags | Label | Module | Local).toCommonFlags
7979

8080
override def nameString(name: Name): String =
81-
if (name.isReplAssignName) name.decode.toString.takeWhile(_ != '$')
82-
else if (ctx.settings.YdebugNames.value) name.debugString
83-
else name.toString
81+
if (ctx.settings.YdebugNames.value) name.debugString else name.toString
8482

8583
override protected def simpleNameString(sym: Symbol): String =
8684
nameString(if (ctx.property(XprintMode).isEmpty) sym.originalName else sym.name)

compiler/src/dotty/tools/dotc/printing/ReplPrinter.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import dotty.tools.dotc.core.Constants.Constant
55
import dotty.tools.dotc.core.Contexts._
66
import dotty.tools.dotc.core.Flags._
77
import dotty.tools.dotc.core.NameOps._
8+
import dotty.tools.dotc.core.Names.Name
89
import dotty.tools.dotc.core.Symbols._
910
import dotty.tools.dotc.core.Types.{ExprType, TypeAlias}
1011
import dotty.tools.dotc.printing.Texts._
@@ -13,6 +14,10 @@ import scala.language.implicitConversions
1314

1415
class ReplPrinter(_ctx: Context) extends DecompilerPrinter(_ctx) {
1516

17+
override def nameString(name: Name): String =
18+
if (name.isReplAssignName) name.decode.toString.takeWhile(_ != '$')
19+
else super.nameString(name)
20+
1621
override protected def exprToText(tp: ExprType): Text =
1722
": " ~ toText(tp.resType)
1823

0 commit comments

Comments
 (0)