diff options
author | Martin Odersky <odersky@gmail.com> | 2013-05-17 13:28:02 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2013-05-17 13:28:02 +0200 |
commit | 94b9a2a0d083cca2ba1358582d8d6fd8143b0b31 (patch) | |
tree | e84279f763b7a241bf18c27c7227d66618936719 /src/dotty/tools/dotc/core/Names.scala | |
parent | d2261b37cf23ccd04e9029f3556c2dc9e2bdf077 (diff) | |
download | dotty-94b9a2a0d083cca2ba1358582d8d6fd8143b0b31.tar.gz dotty-94b9a2a0d083cca2ba1358582d8d6fd8143b0b31.tar.bz2 dotty-94b9a2a0d083cca2ba1358582d8d6fd8143b0b31.zip |
Refactored Printing architecture.
Split printers into several files. Added refined printing of trees. Changed Showable and generalized printing
under a precedence.
Diffstat (limited to 'src/dotty/tools/dotc/core/Names.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/Names.scala | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/core/Names.scala b/src/dotty/tools/dotc/core/Names.scala index c7fedbc4c..e5535cff3 100644 --- a/src/dotty/tools/dotc/core/Names.scala +++ b/src/dotty/tools/dotc/core/Names.scala @@ -3,6 +3,8 @@ package core import scala.io.Codec import util.NameTransformer +import printing.{Showable, Texts, Printer} +import Texts.Text import Decorators._ import Contexts.Context import collection.IndexedSeqOptimized @@ -17,7 +19,7 @@ object Names { /** A common class for things that can be turned into names. * Instances are both names and strings, the latter via a decorator. */ - trait PreName extends Any { + trait PreName extends Any with Showable { def toTypeName: TypeName def toTermName: TermName } @@ -90,7 +92,7 @@ object Names { override def toString = if (length == 0) "" else new String(chrs, start, length) - def show(implicit ctx: Context): String = ctx.nameString(this) + def toText(printer: Printer): Text = printer.toText(this) /** Write to UTF8 representation of this name to given character array. * Start copying to index `to`. Return index of next free byte in array. |