scala.tools.refactoring.transformation

TreeTransformations

trait TreeTransformations extends Transformations with TreeFactory

Self Type
TreeTransformations with EnrichedTrees with CompilerAccess
Linear Supertypes
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. TreeTransformations
  2. TreeFactory
  3. Transformations
  4. AnyRef
  5. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Type Members

  1. implicit class AdditionalListMethods[T] extends AnyRef

    Replace the first sequence of elements with another sequence.

  2. implicit class AdditionalTreeListMethods extends AnyRef

  3. implicit class CopyTypeFromOtherTree extends AnyRef

    Definition Classes
    TreeFactory
  4. abstract class Transformation[X, Y] extends (X) ⇒ Option[Y]

    Definition Classes
    Transformations
  5. implicit class TreeReplacesOtherTreeViaPosition[T <: nsc.Global.Tree] extends AnyRef

Value Members

  1. def ![X](t: ⇒ (TreeTransformations.this)#T[X, X]): (TreeTransformations.this)#Transformation[X, X]

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

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

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

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

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

    Definition Classes
    Any
  7. object Invisible extends nsc.Global.Position

    Definition Classes
    TreeFactory
  8. def abstractFileToTree(file: AbstractFile): nsc.Global.Tree

  9. def addImportTransformation(importsToAdd: Seq[String]): (TreeTransformations.this)#Transformation[nsc.Global.Tree, TextChange]

  10. def allChildren(t: ⇒ (TreeTransformations.this)#T[nsc.Global.Tree, nsc.Global.Tree]): (TreeTransformations.this)#T[nsc.Global.Tree, nsc.Global.Tree]

    Applies a transformation to all subtrees of a tree T, returning a new tree,typically of the same kind as T.

    Applies a transformation to all subtrees of a tree T, returning a new tree,typically of the same kind as T.

    If the transformation fails on one child, abort and fail the whole application.

    Definition Classes
    Transformations
  11. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  12. def bottomup(t: ⇒ (TreeTransformations.this)#T[nsc.Global.Tree, nsc.Global.Tree]): (TreeTransformations.this)#T[nsc.Global.Tree, nsc.Global.Tree]

    Definition Classes
    Transformations
  13. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  14. def constant(y: nsc.Global.Tree): (TreeTransformations.this)#T[nsc.Global.Tree, nsc.Global.Tree]

    Creates a transformation that always returns the value x.

    Creates a transformation that always returns the value x.

    Definition Classes
    Transformations
  15. final def eq(arg0: AnyRef): Boolean

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

    Definition Classes
    AnyRef → Any
  17. def fail[X]: (TreeTransformations.this)#T[X, X]

    Always fails, independent of the input.

    Always fails, independent of the input.

    Definition Classes
    Transformations
  18. def filter(f: PartialFunction[nsc.Global.Tree, Boolean]): (TreeTransformations.this)#T[nsc.Global.Tree, nsc.Global.Tree]

  19. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  20. val findBestPackageForImports: (TreeTransformations.this)#T[nsc.Global.Tree, (nsc.Global.PackageDef, List[nsc.Global.Import], List[nsc.Global.Tree])]

    Finds the "best" package for adding imports, together with the imports it already contains

    Finds the "best" package for adding imports, together with the imports it already contains

    The best package for imports means the innermost package where imports are still visible to all trees that might potentially need them. For example, given

    package a.b.c
    package d
    package e
    
    package e1 {
      object E1
    }
    
    package e2 {
      object E2
    }

    this function returns the package a.b.c.d.e.

  21. final def getClass(): Class[_]

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

    Definition Classes
    AnyRef → Any
  23. def id[X]: (TreeTransformations.this)#T[X, X]

    Definition Classes
    Transformations
  24. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  25. def matchingChildren(t: (TreeTransformations.this)#T[nsc.Global.Tree, nsc.Global.Tree]): (TreeTransformations.this)#T[nsc.Global.Tree, nsc.Global.Tree]

    Applies a transformation to all subtrees of a tree T, returning a new tree,typically of the same kind as T.

    Applies a transformation to all subtrees of a tree T, returning a new tree,typically of the same kind as T.

    If the transformation fails on one child, apply the identity transformation id and don't fail, unlike allChildren.

    Definition Classes
    Transformations
  26. def mkApply(mods: nsc.Global.Modifiers = NoMods, parameters: List[List[nsc.Global.Symbol]] = Nil :: Nil, body: List[nsc.Global.Tree], typeParameters: List[nsc.Global.TypeDef] = Nil): nsc.Global.DefDef

    Definition Classes
    TreeFactory
  27. def mkAssignmentToCall(call: nsc.Global.Tree, returns: List[nsc.Global.Symbol]): nsc.Global.Tree

    Definition Classes
    TreeFactory
  28. def mkBlock(trees: List[nsc.Global.Tree]): nsc.Global.Block

    Definition Classes
    TreeFactory
  29. def mkCallDefDef(name: String, arguments: List[List[nsc.Global.Symbol]] = Nil :: Nil, returns: List[nsc.Global.Symbol] = Nil): nsc.Global.Tree

    Definition Classes
    TreeFactory
  30. def mkCallValDef(name: String, returns: List[nsc.Global.Symbol] = Nil): nsc.Global.Tree

    Definition Classes
    TreeFactory
  31. def mkCanEqual(classSymbol: nsc.Global.Symbol): nsc.Global.DefDef

    Definition Classes
    TreeFactory
  32. def mkCaseClass(mods: nsc.Global.Modifiers = NoMods, name: String, tparams: List[nsc.Global.TypeDef] = Nil, argss: List[List[(nsc.Global.Modifiers, String, nsc.Global.Tree)]] = Nil, body: List[nsc.Global.Tree] = Nil, parents: List[nsc.Global.Tree] = Nil, superArgs: List[nsc.Global.Tree] = Nil): nsc.Global.ClassDef

    Definition Classes
    TreeFactory
  33. def mkClass(mods: nsc.Global.Modifiers = NoMods, name: String, tparams: List[nsc.Global.TypeDef] = Nil, argss: List[List[(nsc.Global.Modifiers, String, nsc.Global.Tree)]] = Nil, body: List[nsc.Global.Tree] = Nil, parents: List[nsc.Global.Tree] = Nil, superArgs: List[nsc.Global.Tree] = Nil): nsc.Global.ClassDef

    Definition Classes
    TreeFactory
  34. def mkDefDef(mods: nsc.Global.Modifiers = NoMods, name: String, parameters: List[List[nsc.Global.Symbol]] = Nil :: Nil, body: List[nsc.Global.Tree], typeParameters: List[nsc.Global.TypeDef] = Nil, returnTypeOpt: Option[nsc.Global.TypeTree] = None): nsc.Global.DefDef

    Definition Classes
    TreeFactory
  35. def mkEquals(classSymbol: nsc.Global.Symbol, classParamsForEqual: List[nsc.Global.ValDef], callSuper: Boolean): nsc.Global.DefDef

    Definition Classes
    TreeFactory
  36. def mkFunctionCallWithFunctionArgument(selector: nsc.Global.Tree, fun: String, param: nsc.Global.TermName, body: nsc.Global.Tree): nsc.Global.Tree

    Creates a function call fun on the selector and passes a function with a single parameter param and the body body.

    Creates a function call fun on the selector and passes a function with a single parameter param and the body body.

    Example:

    someExpr becomes someExpr fun (param => body)

    Definition Classes
    TreeFactory
  37. def mkFunctionCallWithZeroArgFunctionArgument(selector: nsc.Global.Tree, fun: String, body: nsc.Global.Tree): nsc.Global.Tree

    Creates a function call fun on the selector and passes a function with no parameter and the body body.

    Creates a function call fun on the selector and passes a function with no parameter and the body body.

    Example:

    someExpr becomes someExpr fun (body)

    Definition Classes
    TreeFactory
  38. def mkHashcode(classSymbol: nsc.Global.Symbol, classParamsForHashcode: List[nsc.Global.ValDef], callSuper: Boolean, prime: Int = 41): nsc.Global.DefDef

    Definition Classes
    TreeFactory
  39. def mkImportFromStrings(qualifier: String, name: String): nsc.Global.Import

    Definition Classes
    TreeFactory
  40. def mkImportTrees(trees: List[nsc.Global.Select], enclosingPackage: String): collection.immutable.List[nsc.Global.Import]

    Definition Classes
    TreeFactory
  41. def mkModule(mods: nsc.Global.Modifiers = NoMods, name: String, body: List[nsc.Global.Tree] = Nil, parents: List[nsc.Global.Tree] = Nil): nsc.Global.ModuleDef

    Definition Classes
    TreeFactory
  42. def mkParam(name: String, tpe: nsc.Global.Type, defaultVal: nsc.Global.Tree = EmptyTree): nsc.Global.ValDef

    Definition Classes
    TreeFactory
  43. def mkRenamedImportTree(t: (TreeTransformations.this)#ImportSelectorTree, name: String): (TreeTransformations.this)#ImportSelectorTree

    Definition Classes
    TreeFactory
  44. def mkRenamedSymTree(t: nsc.Global.SymTree, nameString: String): nsc.Global.SymTree

    Definition Classes
    TreeFactory
  45. def mkRenamedTypeTree(t: nsc.Global.TypeTree, name: String, originalSymbol: nsc.Global.Symbol): nsc.Global.TypeTree

    Definition Classes
    TreeFactory
  46. def mkReturn(s: List[nsc.Global.Symbol]): nsc.Global.Tree

    Definition Classes
    TreeFactory
  47. def mkValDef(name: String, rhs: nsc.Global.Tree, tpt: nsc.Global.TypeTree = new TypeTree): nsc.Global.ValDef

    Definition Classes
    TreeFactory
  48. def mkValOrVarDef(mods: nsc.Global.Modifiers, name: String, rhs: nsc.Global.Tree, tpt: nsc.Global.TypeTree = new TypeTree): nsc.Global.ValDef

    Definition Classes
    TreeFactory
  49. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  50. def not[X](t: ⇒ (TreeTransformations.this)#T[X, X]): (TreeTransformations.this)#Transformation[X, X]

    Definition Classes
    Transformations
  51. final def notify(): Unit

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

    Definition Classes
    AnyRef
  53. def once[X <: AnyRef](t: (TreeTransformations.this)#T[X, X]): (TreeTransformations.this)#T[X, X]

    Do a transformation until it succeeded once, then just fail.

    Do a transformation until it succeeded once, then just fail.

    Note that because of the statefulness of once, you need to make sure that it isn't accidentally passed as a by-name parameter to another transformation and instantiated multiple times.

    Definition Classes
    Transformations
  54. def postorder(t: ⇒ (TreeTransformations.this)#T[nsc.Global.Tree, nsc.Global.Tree]): (TreeTransformations.this)#T[nsc.Global.Tree, nsc.Global.Tree]

    Definition Classes
    Transformations
  55. def predicate[X](f: (X) ⇒ Boolean): (TreeTransformations.this)#T[X, X]

    Definition Classes
    Transformations
  56. def predicate[X](f: PartialFunction[X, Boolean]): (TreeTransformations.this)#T[X, X]

    We often want to use transformations as predicates, which execute the next transformations if the result is true.

    We often want to use transformations as predicates, which execute the next transformations if the result is true. For example:

    val tree_with_range_pos = filter[Tree] { case t: Tree => t.pos.isRange }

    We can then use the predicate like this: tree_with_range_pos andThen do_something_with_the_tree orElse nothing

    Definition Classes
    Transformations
  57. def preorder(t: ⇒ (TreeTransformations.this)#T[nsc.Global.Tree, nsc.Global.Tree]): (TreeTransformations.this)#T[nsc.Global.Tree, nsc.Global.Tree]

    Definition Classes
    Transformations
  58. def replaceTree(from: nsc.Global.Tree, to: nsc.Global.Tree): (TreeTransformations.this)#T[nsc.Global.Tree, nsc.Global.Tree]

  59. val setNoPosition: (TreeTransformations.this)#T[nsc.Global.Tree, nsc.Global.Tree]

  60. def shallowDuplicate[T <: nsc.Global.Tree](orig: T): T

  61. def succeed[X]: (TreeTransformations.this)#T[X, X]

    Always succeeds and returns the input unchanged.

    Always succeeds and returns the input unchanged.

    Definition Classes
    Transformations
  62. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  63. def toString(): String

    Definition Classes
    AnyRef → Any
  64. def topdown(t: ⇒ (TreeTransformations.this)#T[nsc.Global.Tree, nsc.Global.Tree]): (TreeTransformations.this)#T[nsc.Global.Tree, nsc.Global.Tree]

    Definition Classes
    Transformations
  65. def transform(f: PartialFunction[nsc.Global.Tree, nsc.Global.Tree]): (TreeTransformations.this)#T[nsc.Global.Tree, nsc.Global.Tree]

  66. def transformation[X, Y](f: PartialFunction[X, Y]): (TreeTransformations.this)#T[X, Y]

    Construct a transformation from a partial function; this is the most commonly used way to create new transformations, for example like:

    Construct a transformation from a partial function; this is the most commonly used way to create new transformations, for example like:

    val reverse_all_class_members = transformation[Tree, Tree] { case t: Template => t.copy(body = t.body.reverse) }

    Definition Classes
    Transformations
  67. def traverse(tree: nsc.Global.Tree, f: (nsc.Global.Tree) ⇒ nsc.Global.Tree): nsc.Global.Tree

    Definition Classes
    TreeTransformationsTransformations
  68. def traverseAndTransformAll(t: ⇒ (TreeTransformations.this)#T[nsc.Global.Tree, nsc.Global.Tree]): (TreeTransformations.this)#T[nsc.Global.Tree, nsc.Global.Tree]

    Definition Classes
    Transformations
  69. final def wait(): Unit

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  72. def (t: ⇒ (TreeTransformations.this)#T[nsc.Global.Tree, nsc.Global.Tree]): (TreeTransformations.this)#T[nsc.Global.Tree, nsc.Global.Tree]

    Applies a transformation bottom-up, that is, it applies the transformation to the children of the tree first and then to their parent.

    Applies a transformation bottom-up, that is, it applies the transformation to the children of the tree first and then to their parent. The consequence is that the parent "sees" its transformed children.

    Definition Classes
    Transformations
  73. def (t: ⇒ (TreeTransformations.this)#T[nsc.Global.Tree, nsc.Global.Tree]): (TreeTransformations.this)#T[nsc.Global.Tree, nsc.Global.Tree]

    Applies a transformation top-down, that is, it applies the transformation to the tree T and then passes the transformed T to all children.

    Applies a transformation top-down, that is, it applies the transformation to the tree T and then passes the transformed T to all children. The consequence is that the children "see" their new parent.

    Definition Classes
    Transformations

Inherited from TreeFactory

Inherited from Transformations

Inherited from AnyRef

Inherited from Any

Ungrouped