Trait

scala.tools.refactoring.transformation

TreeTransformations

Related Doc: package transformation

Permalink

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
Visibility
  1. Public
  2. All

Type Members

  1. implicit class AdditionalListMethods[T] extends AnyRef

    Permalink

    Replace the first sequence of elements with another sequence.

  2. implicit class AdditionalTreeListMethods extends AnyRef

    Permalink
  3. implicit class CopyTypeFromOtherTree extends AnyRef

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

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

    Permalink

Value Members

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

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

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

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

    Permalink
    Definition Classes
    AnyRef → Any
  5. object Invisible extends nsc.Global.Position

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

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

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

    Permalink

    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
  9. final def asInstanceOf[T0]: T0

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

    Permalink
    Definition Classes
    Transformations
  11. def clone(): AnyRef

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

    Permalink

    Creates a transformation that always returns the value x.

    Creates a transformation that always returns the value x.

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

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

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

    Permalink

    Always fails, independent of the input.

    Always fails, independent of the input.

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

    Permalink
  17. def finalize(): Unit

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

    Permalink

    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.

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

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

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

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

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

    Permalink

    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
  24. 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

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

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

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

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

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

    Permalink
    Definition Classes
    TreeFactory
  30. 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

    Permalink
    Definition Classes
    TreeFactory
  31. 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

    Permalink
    Definition Classes
    TreeFactory
  32. 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

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

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

    Permalink

    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
  35. def mkFunctionCallWithZeroArgFunctionArgument(selector: nsc.Global.Tree, fun: String, body: nsc.Global.Tree): nsc.Global.Tree

    Permalink

    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
  36. def mkHashcode(classSymbol: nsc.Global.Symbol, classParamsForHashcode: List[nsc.Global.ValDef], callSuper: Boolean, prime: Int = 41): nsc.Global.DefDef

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

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

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

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

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

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

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

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

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

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

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

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

    Permalink
    Definition Classes
    Transformations
  49. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  50. final def notifyAll(): Unit

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

    Permalink

    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
  52. def postorder(t: ⇒ (TreeTransformations.this)#T[nsc.Global.Tree, nsc.Global.Tree]): (TreeTransformations.this)#T[nsc.Global.Tree, nsc.Global.Tree]

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

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

    Permalink

    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
  55. def preorder(t: ⇒ (TreeTransformations.this)#T[nsc.Global.Tree, nsc.Global.Tree]): (TreeTransformations.this)#T[nsc.Global.Tree, nsc.Global.Tree]

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

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

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

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

    Permalink

    Always succeeds and returns the input unchanged.

    Always succeeds and returns the input unchanged.

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

    Permalink
    Definition Classes
    AnyRef
  61. def toString(): String

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

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

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

    Permalink

    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
  65. def traverse(tree: nsc.Global.Tree, f: (nsc.Global.Tree) ⇒ nsc.Global.Tree): nsc.Global.Tree

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

    Permalink
    Definition Classes
    Transformations
  67. final def wait(): Unit

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

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

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

    Permalink

    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
  71. def (t: ⇒ (TreeTransformations.this)#T[nsc.Global.Tree, nsc.Global.Tree]): (TreeTransformations.this)#T[nsc.Global.Tree, nsc.Global.Tree]

    Permalink

    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