Represent an import selector as a tree, including both names as trees.
Represent an import selector as a tree, including both names as trees.
Import selectors are not trees, but we can provide an extractor that converts the ImportSelectors into our own ImportSelectorTrees.
Import selectors are not trees, but we can provide an extractor that converts the ImportSelectors into our own ImportSelectorTrees.
Declarations of values and types that are not class members are transformed to LocalScopes.
Declarations of values and types that are not class members are
transformed to LocalScopes. This also includes parameter lists
and bindings in case
statements.
One LocalScope can also represent more than one declaration if it is constructed from parameter lists or bindings.
Traits, classes, objects and packages are transformed to MemberScopes.
Traits, classes, objects and packages are transformed to MemberScopes.
MemberScopes are not structure sensitive. Therefore a member is also visible at positions before its definition.
Represent a modifier as a tree, including its position.
Represent a modifier as a tree, including its position.
Represent a Name as a tree, including its position.
Represent a Name as a tree, including its position.
The PlainText "tree" provides a hook into the source code generation.
The PlainText "tree" provides a hook into the source code generation.
When a PlainText tree occurs during source code generation, its print
method is called with the current AbstractPrinter#PrintingContext. The
result is inserted into the generated source code.
For some use cases (blank line, raw and indented string) implementations
already exist in the PlainText
object.
Note that PlainText trees should never be allowed to escape the Scala refactoring library, so be careful when using compiler utilities to transform trees.
Representation of self type annotations: self: A with B => ^^^^^^^^^^^^^^
Representation of self type annotations: self: A with B => ^^^^^^^^^^^^^^
The call to the super constructor in a class: class A(i: Int) extends B(i) ^^^^
The call to the super constructor in a class: class A(i: Int) extends B(i) ^^^^
Use TraversalTracing for debugging and PlainTraversals for production
Use TraversalTracing for debugging and PlainTraversals for production
A traverser that also traverses a TypeTree's original type.
A traverser that also traverses a TypeTree's original type.
A traverser that creates fake trees for various type trees so they can be treated as if they were regular trees.
A traverser that creates fake trees for various type trees so they can be treated as if they were regular trees.
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.
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.
A SourceLayoutTree can be used to insert arbitrary text into the code, for example, blank lines.
A SourceLayoutTree can be used to insert arbitrary text into the code, for example, blank lines.
(Since version 0.5.0) Use PlainText objects and its components
Extracts information from ApplyNodes
Extracts information from ApplyNodes
The main feature of this extractor is that reverses the desugarings the compiler performs for named arguments by creating scala.tools.refactoring.common.EnrichedTrees.NamedArgument instances as necessary. Apart from that, this object is meant to mimic the regular scala.reflect.api.Trees.ApplyExtractor.
Unify the children of a Block tree and sort them in the same order they appear in the source code.
Unify the children of a Block tree and sort them in the same order they appear in the source code.
Also reshapes some trees: multiple assignments are removed and named argument trees are created.
Note that this extractor is needed primarily for tree printing. The rename refactoring for example, that doesn't use tree printing, would work with
object BlockExtractor { def unapply(t: Block) = { Some(t.expr :: t.stats) } }
as well.
Extract the modifiers with their position from a Modifiers object.
Extract the modifiers with their position from a Modifiers object.
Provides a finer-grained extractor for Template that distinguishes between class constructor parameters, early definitions, parents, self type annotation and the real body.
Provides a finer-grained extractor for Template that distinguishes between class constructor parameters, early definitions, parents, self type annotation and the real body.
Copy of scala.reflect.internal.Trees.ValOrDefDef of 2.11 to support 2.10.
Copy of scala.reflect.internal.Trees.ValOrDefDef of 2.11 to support 2.10.
Returns the (symbol) ancestors of the tree excluding the ROOT in descending order. Also filters the symbols for package objects!
Converts a tree containing Idents and Selects to a .
separated string.
Converts a tree containing Idents and Selects to a .
separated string.
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.
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.
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.
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.
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.
The expr of an Import tree.
The name of an ImportSelector of the import.
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.
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
.
(Since version 0.5.0) Use PlainText objects and its components