aboutsummaryrefslogblamecommitdiff
path: root/src/dotty/tools/dotc/printing/Showable.scala
blob: cb65193e6fb962a237bf3d4be5626ba97802057d (plain) (tree)
1
2
3
4
5
6
7
8
9
                        
                
 


                                        
 
                            
 




                                                       
 



                                                                
 

                                                                    
 
package dotty.tools.dotc
package printing

import core._

import Contexts._, Texts._, Decorators._

trait Showable extends Any {

  /** The text representation of this showable element.
   *  This normally dispatches to a pattern matching
   *  method in Printers.
   */
  def toText(printer: Printer): Text

  /** A fallback text representation, if the pattern matching
   *  in Printers does not have a case for this showable element
   */
  def fallbackToText(printer: Printer): Text = toString

  /** The string representation of this showable element. */
  def show(implicit ctx: Context): String = toText(ctx.printer).show
}