scala.tools.refactoring.sourcegen

SourceGenerator

trait SourceGenerator extends PrettyPrinter with Indentations with ReusingPrinter with PimpedTrees with LayoutHelper with Formatting with TreeChangesDiscoverer

Self Type
SourceGenerator with Tracing with CompilerAccess
Linear Supertypes
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. SourceGenerator
  2. TreeChangesDiscoverer
  3. Formatting
  4. LayoutHelper
  5. PimpedTrees
  6. ReusingPrinter
  7. Indentations
  8. PrettyPrinter
  9. AbstractPrinter
  10. CommonPrintUtils
  11. TreePrintingTraversals
  12. AnyRef
  13. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Type Members

  1. trait BlockPrinters extends AnyRef

    Definition Classes
    ReusingPrinter
  2. trait ChangeSet extends AnyRef

    Definition Classes
    AbstractPrinter
  3. trait ClassModulePrinters extends AnyRef

    Definition Classes
    ReusingPrinter
  4. implicit class DefDefMethods extends AnyRef

    Definition Classes
    PimpedTrees
  5. trait FunctionPrinters extends AnyRef

    Definition Classes
    ReusingPrinter
  6. trait IfPrinters extends AnyRef

    Definition Classes
    ReusingPrinter
  7. trait ImportPrinters extends AnyRef

    Definition Classes
    ReusingPrinter
  8. case class ImportSelectorTree(name: (PimpedTrees.this)#NameTree, rename: nsc.Global.Tree) extends nsc.Global.Tree with Product with Serializable

    Represent an import selector as a tree, including both names as trees.

  9. implicit class ImportSelectorTreeExtractor extends AnyRef

    Import selectors are not trees, but we can provide an extractor that converts the ImportSelectors into our own ImportSelectorTrees.

  10. class Indentation extends AnyRef

    Definition Classes
    Indentations
  11. trait LiteralPrinters extends AnyRef

    Definition Classes
    ReusingPrinter
  12. trait MethodCallPrinters extends AnyRef

    Definition Classes
    ReusingPrinter
  13. trait MiscPrinters extends AnyRef

    Definition Classes
    ReusingPrinter
  14. case class ModifierTree(flag: Long) extends nsc.Global.Tree with Product with Serializable

    Represent a modifier as a tree, including its position.

  15. case class MultipleAssignment(extractor: nsc.Global.Tree, names: List[nsc.Global.ValDef], rhs: nsc.Global.Tree) extends nsc.Global.Tree with Product with Serializable

    Definition Classes
    PimpedTrees
  16. case class NameTree(name: nsc.Global.Name) extends nsc.Global.Tree with Product with Serializable

    Represent a Name as a tree, including its position.

  17. case class NamedArgument(nameTree: (PimpedTrees.this)#NameTree, rhs: nsc.Global.Tree) extends nsc.Global.SymTree with nsc.Global.RefTree with Product with Serializable

    Definition Classes
    PimpedTrees
  18. class NotInstanceOf[T] extends AnyRef

    Definition Classes
    PimpedTrees
  19. trait PackagePrinters extends AnyRef

    Definition Classes
    ReusingPrinter
  20. trait PatternMatchingPrinters extends AnyRef

    Definition Classes
    ReusingPrinter
  21. abstract class PlainText extends nsc.Global.Tree

    The PlainText "tree" provides a hook into the source code generation.

  22. case class PrintingContext(ind: (AbstractPrinter.this)#Indentation, changeSet: (AbstractPrinter.this)#ChangeSet, parent: nsc.Global.Tree, file: Option[SourceFile]) extends Product with Serializable

    PrintingContext is passed around with all the print methods and contains the context or environment for the current printing.

  23. trait PrintingUtils extends AnyRef

    Definition Classes
    ReusingPrinter
  24. case class SelfTypeTree(name: (PimpedTrees.this)#NameTree, tpt: nsc.Global.Tree) extends nsc.Global.Tree with Product with Serializable

    Representation of self type annotations: self: A with B => ^^^^^^^^^^^^^^

  25. case class SuperConstructorCall(clazz: nsc.Global.Tree, args: List[nsc.Global.Tree]) extends nsc.Global.Tree with Product with Serializable

    The call to the super constructor in a class: class A(i: Int) extends B(i) ^^^^

  26. trait SuperPrinters extends AnyRef

    Definition Classes
    ReusingPrinter
  27. class TemplateMethods extends AnyRef

    Definition Classes
    PimpedTrees
  28. class TreeMethodsForPositions extends AnyRef

    Add some methods to Tree that make it easier to compare Trees by position and to extract the position of a tree's name, which is tricky for Selects.

  29. trait TreePrinting extends AnyRef

    Definition Classes
    TreePrintingTraversals
  30. trait TryThrowPrinters extends AnyRef

    Definition Classes
    ReusingPrinter
  31. trait TypePrinters extends AnyRef

    Definition Classes
    ReusingPrinter
  32. trait ValDefDefPrinters extends AnyRef

    Definition Classes
    ReusingPrinter
  33. trait WhilePrinters extends AnyRef

    Definition Classes
    ReusingPrinter
  34. case class SourceLayoutTree(kind: Kinds) extends nsc.Global.Tree with Product with Serializable

    A SourceLayoutTree can be used to insert arbitrary text into the code, for example, blank lines.

Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. object AllTreesHaveChanged extends (SourceGenerator.this)#ChangeSet

  7. object ApplyExtractor

    Definition Classes
    PimpedTrees
  8. object BlockExtractor

    Unify the children of a Block tree and sort them in the same order they appear in the source code.

  9. object ModifierTree extends Serializable

    Extract the modifiers with their position from a Modifiers object.

  10. object NameTree extends Serializable

    Definition Classes
    PimpedTrees
  11. object NoBlock extends (PimpedTrees.this)#NotInstanceOf[nsc.Global.Block]

    Definition Classes
    PimpedTrees
  12. object NoFunction extends (PimpedTrees.this)#NotInstanceOf[nsc.Global.Function]

    Definition Classes
    PimpedTrees
  13. object NoImportSelectorTree extends (PimpedTrees.this)#NotInstanceOf[(PimpedTrees.this)#ImportSelectorTree]

    Definition Classes
    PimpedTrees
  14. object NoPackageDef extends (PimpedTrees.this)#NotInstanceOf[nsc.Global.PackageDef]

    Definition Classes
    PimpedTrees
  15. object PlainText

    Definition Classes
    PimpedTrees
  16. object TemplateExtractor

    Provides a finer-grained extractor for Template that distinguishes between class constructor parameters, early definitions, parents, self type annotation and the real body.

  17. implicit def additionalTemplateMethods(t: nsc.Global.Template): (SourceGenerator.this)#TemplateMethods

    Definition Classes
    PimpedTrees
  18. implicit def additionalTreeMethodsForPositions(t: nsc.Global.Tree): (SourceGenerator.this)#TreeMethodsForPositions

    Definition Classes
    PimpedTrees
  19. def adjustedStartPosForSourceExtraction(t: nsc.Global.Tree, p: nsc.Global.Position): nsc.Global.Position

    When extracting source code from the file via a tree's position, it depends on the tree type whether we can use the position's start or point.

    When extracting source code from the file via a tree's position, it depends on the tree type whether we can use the position's start or point.

    t

    The tree that will be replaced.

    p

    The position to adapt. This does not have to be the position of t.

    Definition Classes
    CommonPrintUtils
  20. def ancestorSymbols(t: nsc.Global.Tree): List[nsc.Global.Symbol]

    returns

    Returns the (symbol) ancestors of the tree excluding the ROOT in descending order. Also filters the symbols for package objects!

    Definition Classes
    PimpedTrees
  21. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  22. def asSelectorString(t: nsc.Global.Tree): String

    Converts a tree containing Idents and Selects to a . separated string.

    Converts a tree containing Idents and Selects to a . separated string.

    Definition Classes
    PimpedTrees
  23. def balanceParens(open: Char, close: Char)(f: Fragment): EmptyFragment { val center: scala.tools.refactoring.sourcegen.Layout{val asText: String} }

    Definition Classes
    CommonPrintUtils
  24. def balanceParensInLayout(open: Char, close: Char, l: Layout): Layout

    Definition Classes
    CommonPrintUtils
  25. def between(l: nsc.Global.Tree, r: nsc.Global.Tree): LayoutFromFile

    Definition Classes
    LayoutHelper
  26. def betweenEndAndPoint(t1: nsc.Global.Tree, t2: nsc.Global.Tree): LayoutFromFile

    Definition Classes
    LayoutHelper
  27. def betweenPointAndEnd(t1: nsc.Global.Tree): LayoutFromFile

    Definition Classes
    LayoutHelper
  28. def betweenStartAndEnd(t1: nsc.Global.Tree): LayoutFromFile

    Definition Classes
    LayoutHelper
  29. def betweenStartAndPoint(t1: nsc.Global.Tree): LayoutFromFile

    Definition Classes
    LayoutHelper
  30. def children: (nsc.Global.Tree) ⇒ List[nsc.Global.Tree]

    Returns all children that have a representation in the source code.

    Returns all children that have a representation in the source code. This includes Name and Modifier trees and excludes everything that has no Position or is an EmptyTree.

    Definition Classes
    PimpedTrees
  31. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  32. def createChanges(ts: List[nsc.Global.Tree]): List[TextChange]

    Creates a list of TextChanges from a list of trees, regenerating only those trees that have changed.

  33. def createFragment(t: nsc.Global.Tree): Fragment

    Creates a fragment from a tree, regenerating only those trees that have changed.

  34. def createText(t: nsc.Global.Tree, sourceFile: Option[SourceFile] = None): String

    Creates a string from a tree, regenerating all trees.

    Creates a string from a tree, regenerating all trees.

    If the sourceFile parameter is passed, it will be used to figure out what kinds of newline separators we should generate. If None is passed, '\n' is used.

  35. def defaultIndentationStep: String

    The characters that are used to indent changed code.

    The characters that are used to indent changed code.

    Definition Classes
    Formatting
  36. def endPositionAtEndOfSourceFile(pos: nsc.Global.Position, otherWise: Option[Int] = None): Int

    Trees that reach the end of the file don't seem to have the correct end position, except if there's a newline at the end.

    Trees that reach the end of the file don't seem to have the correct end position, except if there's a newline at the end.

    Definition Classes
    PimpedTrees
  37. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  38. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  39. def escapeScalaKeywordsForImport(n: String): String

    Definition Classes
    PimpedTrees
  40. def escapeScalaKeywordsForImport(n: nsc.Global.Name): String

    Takes a name and wraps it in if the name corresponds to a Scala keyword.

    Takes a name and wraps it in if the name corresponds to a Scala keyword.

    Definition Classes
    PimpedTrees
  41. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  42. def findAllChangedTrees(t: nsc.Global.Tree): List[(nsc.Global.Tree, nsc.Global.Position, Set[nsc.Global.Tree])]

    Starting from a root tree, returns all children that have changed.

    Starting from a root tree, returns all children that have changed. The format of the result is a tuple of a top-level tree, a position of the range that should be replaced and a set of all trees that changed in the context of that top-level tree, including the top-level tree.

    Definition Classes
    TreeChangesDiscoverer
  43. val findAllTreesWithTheSamePosition: (nsc.Global.Tree) ⇒ Iterable[nsc.Global.Tree]

    Definition Classes
    PimpedTrees
  44. def findOriginalTree: (nsc.Global.Tree) ⇒ Option[nsc.Global.Tree]

    Finds a tree by its position, can be used to find the original tree from a transformed tree.

    Finds a tree by its position, can be used to find the original tree from a transformed tree.

    If multiple trees are candidates, then take the last one, because it is likely more specific.

    Definition Classes
    PimpedTrees
  45. def findSymbolForImportSelector(expr: nsc.Global.Tree, name: nsc.Global.Name): Option[nsc.Global.Symbol]

    Searches for a Symbol of a name in the type members of a tree.

    Searches for a Symbol of a name in the type members of a tree.

    This is mainly used for ImportSelectors, which don't carry any symbol information with them.

    expr

    The expr of an Import tree.

    name

    The name of an ImportSelector of the import.

    Definition Classes
    PimpedTrees
  46. def findTopLevelTrees(ts: List[nsc.Global.Tree]): collection.immutable.List[nsc.Global.Tree]

    Definition Classes
    TreeChangesDiscoverer
  47. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  48. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  49. def indentation(implicit ctx: (SourceGenerator.this)#PrintingContext): String

    Definition Classes
    CommonPrintUtils
  50. def indentationString(tree: nsc.Global.Tree): String

    Definition Classes
    Indentations
  51. def indentedNewline(implicit ctx: (SourceGenerator.this)#PrintingContext): Requisite { def getLayout: scala.tools.refactoring.sourcegen.Layout{val asText: String} }

    Definition Classes
    CommonPrintUtils
  52. def isClassTag(c: nsc.Global.Constant): Boolean

    Definition Classes
    PimpedTrees
  53. def isEmptyTree(t: nsc.Global.Tree): Boolean

    Returns whether the tree is considered empty.

    Returns whether the tree is considered empty.

    Prior to Scala 2.10.1 it was sufficient to check Tree#isEmpty, but now we also need to check if the tree is equal to emptyValDef.

    Definition Classes
    PimpedTrees
  54. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  55. def keepTree(t: nsc.Global.Tree): Boolean

    Definition Classes
    PimpedTrees
  56. def layout(start: Int, end: Int)(implicit s: SourceFile): LayoutFromFile

    Definition Classes
    LayoutHelper
  57. def layoutForCompilationUnitRoot(t: nsc.Global.Tree): (Layout, Layout)

    Definition Classes
    LayoutHelper
  58. def layoutForEnclosedChild(t: nsc.Global.Tree, left: nsc.Global.Tree, right: nsc.Global.Tree, parent: nsc.Global.Tree): (Layout, Layout)

    Definition Classes
    LayoutHelper
  59. def layoutForLeftOuterChild(t: nsc.Global.Tree, parent: nsc.Global.Tree, right: nsc.Global.Tree): (Layout, Layout)

    Definition Classes
    LayoutHelper
  60. def layoutForRightOuterChild(t: nsc.Global.Tree, parent: nsc.Global.Tree, left: nsc.Global.Tree): (Layout, Layout)

    Definition Classes
    LayoutHelper
  61. def layoutForSingleChild(t: nsc.Global.Tree, p: nsc.Global.Tree): (Layout, Layout)

    Definition Classes
    LayoutHelper
  62. def leadingLayoutForTree(t: nsc.Global.Tree): Layout

    Definition Classes
    LayoutHelper
  63. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  64. def newline(implicit ctx: (SourceGenerator.this)#PrintingContext): Requisite { def getLayout: scala.tools.refactoring.sourcegen.Layout{val asText: String} }

    Definition Classes
    CommonPrintUtils
  65. def newlineIndentedToChildren(implicit ctx: (SourceGenerator.this)#PrintingContext): Requisite { def getLayout: scala.tools.refactoring.sourcegen.Layout{val asText: String} }

    Definition Classes
    CommonPrintUtils
  66. final def notify(): Unit

    Definition Classes
    AnyRef
  67. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  68. val originalLeftSibling: (nsc.Global.Tree) ⇒ Option[nsc.Global.Tree]

    Definition Classes
    PimpedTrees
  69. val originalParentOf: (nsc.Global.Tree) ⇒ Option[nsc.Global.Tree]

    Definition Classes
    PimpedTrees
  70. val originalRightSibling: (nsc.Global.Tree) ⇒ Option[nsc.Global.Tree]

    Definition Classes
    PimpedTrees
  71. lazy val precedence: (nsc.Global.Name) ⇒ Int

    Definition Classes
    CommonPrintUtils
  72. object prettyPrinter extends (PrettyPrinter.this)#TreePrinting with (PrettyPrinter.this)#PrintingUtils with (PrettyPrinter.this)#MiscPrinters with (PrettyPrinter.this)#MethodCallPrinters with (PrettyPrinter.this)#WhilePrinters with (PrettyPrinter.this)#PatternMatchingPrinters with (PrettyPrinter.this)#TypePrinters with (PrettyPrinter.this)#FunctionPrinters with (PrettyPrinter.this)#ImportPrinters with (PrettyPrinter.this)#PackagePrinters with (PrettyPrinter.this)#TryThrowPrinters with (PrettyPrinter.this)#ClassModulePrinters with (PrettyPrinter.this)#IfPrinters with (PrettyPrinter.this)#ValDefDefPrinters with (PrettyPrinter.this)#SuperPrinters with (PrettyPrinter.this)#BlockPrinters with (PrettyPrinter.this)#LiteralPrinters

    Definition Classes
    PrettyPrinter
  73. def print(t: nsc.Global.Tree, ctx: (SourceGenerator.this)#PrintingContext): Fragment

    Definition Classes
    SourceGeneratorAbstractPrinter
  74. object reusingPrinter extends (ReusingPrinter.this)#TreePrinting with (ReusingPrinter.this)#PrintingUtils with (ReusingPrinter.this)#MiscPrinters with (ReusingPrinter.this)#MethodCallPrinters with (ReusingPrinter.this)#WhilePrinters with (ReusingPrinter.this)#PatternMatchingPrinters with (ReusingPrinter.this)#TypePrinters with (ReusingPrinter.this)#FunctionPrinters with (ReusingPrinter.this)#ImportPrinters with (ReusingPrinter.this)#PackagePrinters with (ReusingPrinter.this)#TryThrowPrinters with (ReusingPrinter.this)#ClassModulePrinters with (ReusingPrinter.this)#IfPrinters with (ReusingPrinter.this)#ValDefDefPrinters with (ReusingPrinter.this)#SuperPrinters with (ReusingPrinter.this)#BlockPrinters with (ReusingPrinter.this)#LiteralPrinters

    Definition Classes
    ReusingPrinter
  75. def spacingAroundMultipleImports: String

    The characters that surround an import with multiple import selectors inside the braces:

    The characters that surround an import with multiple import selectors inside the braces:

    import a.{*name*}

    Definition Classes
    Formatting
  76. def splitLayoutBetweenLastChildAndParent(child: nsc.Global.Tree, parent: nsc.Global.Tree): (Layout, Layout)

    Definition Classes
    LayoutHelper
  77. def splitLayoutBetweenParentAndFirstChild(child: nsc.Global.Tree, parent: nsc.Global.Tree): (Layout, Layout)

    Definition Classes
    LayoutHelper
  78. def splitLayoutBetweenSiblings(parent: nsc.Global.Tree, left: nsc.Global.Tree, right: nsc.Global.Tree): (Layout, Layout)

    Definition Classes
    LayoutHelper
  79. def surroundingLayoutFromParentsAndSiblings(t: nsc.Global.Tree): (Layout, Layout)

    Definition Classes
    LayoutHelper
  80. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  81. def toString(): String

    Definition Classes
    AnyRef → Any
  82. def topPackageDef(t: nsc.Global.PackageDef): nsc.Global.PackageDef

    returns

    Returns the most specific package declaration in the compilation unit. For example, given the following declaration:

    package a package b

    class C

    it returns b. If there are further nested packages, they are ignored:

    package a class C package b

    returns a.

    Definition Classes
    PimpedTrees
  83. def trailingLayoutForTree(t: nsc.Global.Tree): Layout

    Definition Classes
    LayoutHelper
  84. def typeToString(tree: nsc.Global.TypeTree, t: nsc.Global.Type)(implicit ctx: (SourceGenerator.this)#PrintingContext): String

    Definition Classes
    CommonPrintUtils
  85. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  86. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  87. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Deprecated Value Members

  1. object SourceLayouts

    Definition Classes
    PimpedTrees
    Annotations
    @deprecated
    Deprecated

    (Since version 0.5.0) Use PlainText objects and its components

Inherited from TreeChangesDiscoverer

Inherited from Formatting

Inherited from LayoutHelper

Inherited from PimpedTrees

Inherited from ReusingPrinter

Inherited from Indentations

Inherited from PrettyPrinter

Inherited from AbstractPrinter

Inherited from CommonPrintUtils

Inherited from TreePrintingTraversals

Inherited from AnyRef

Inherited from Any

Ungrouped