A method that should be called from every well-designed equals method that is open to be overridden in a subclass.
A method that should be called from every well-designed equals method that is open to be overridden in a subclass. See Programming in Scala, Chapter 28 for discussion and design.
the value being probed for possible equality
true if this instance can possibly equal that
, otherwise false
Can this tree carry attributes (i.
Can this tree carry attributes (i.e. symbols, types or positions)?
Typically the answer is yes, except for the EmptyTree
null object and
two special singletons: emptyValDef
and pendingSuperCall
.
The direct child trees of this tree.
The direct child trees of this tree. EmptyTrees are always omitted. Lists are flattened.
Apply pf' to each subtree on which the function is defined and collect the results.
Apply pf' to each subtree on which the function is defined and collect the results.
Make a copy of this tree, keeping all attributes, except that all positions are focused (so nothing in this tree will be found when searching by position).
Make a copy of this tree, keeping all attributes, except that all positions are focused (so nothing in this tree will be found when searching by position).
Tests whether two trees are structurall equal.
Tests whether two trees are structurall equal.
Note that ==
on trees is reference equality.
Is there exists a part of this tree which satisfies predicate p
?
Is there exists a part of this tree which satisfies predicate p
?
Find all subtrees matching predicate p
.
Find all subtrees matching predicate p
. Same as withFilter
Returns optionally first tree (in a preorder traversal) which satisfies predicate p
,
or None if none exists.
Returns optionally first tree (in a preorder traversal) which satisfies predicate p
,
or None if none exists.
Do all parts of this tree satisfy predicate p
?
Do all parts of this tree satisfy predicate p
?
Apply f
to each subtree
Apply f
to each subtree
Extracts free term symbols from a tree that is reified or contains reified subtrees.
Extracts free term symbols from a tree that is reified or contains reified subtrees.
Extracts free type symbols from a tree that is reified or contains reified subtrees.
Extracts free type symbols from a tree that is reified or contains reified subtrees.
Does this tree represent a definition? (of a method, of a class, etc)
Does this tree represent a definition? (of a method, of a class, etc)
Is this tree one of the empty trees?
Is this tree one of the empty trees?
Empty trees are: the EmptyTree
null object, TypeTree
instances that don't carry a type
and the special emptyValDef
singleton.
In the compiler the isEmpty
check and the derived orElse
method are mostly used
as a check for a tree being a null object (EmptyTree
for term trees and empty TypeTree for type trees).
Unfortunately emptyValDef
is also considered to be isEmpty
, but this is deemed to be
a conceptual mistake pending a fix in https://issues.scala-lang.org/browse/SI-6762.
canHaveAttrs
The canonical way to test if a Tree represents a term.
The canonical way to test if a Tree represents a term.
The canonical way to test if a Tree represents a type.
The canonical way to test if a Tree represents a type.
Is this tree one of the empty trees?
Is this tree one of the empty trees?
isEmpty
Provides an alternate if tree is empty
Provides an alternate if tree is empty
The alternate tree
If this tree is non empty, this tree, otherwise alt
.
Position of the tree.
Position of the tree.
The size of this product.
The size of this product.
for a product A(x_{1}, ..., x_{k})
, returns k
The n^{th} element of this product, 0-based.
The n^{th} element of this product, 0-based. In other words, for a
product A(x_{1}, ..., x_{k})
, returns x_{(n+1)}
where 0 < n < k
.
the index of the element to return
the element n
elements after the first element
The qualifier of the this
expression.
The qualifier of the this
expression.
For an unqualified this
refers to the enclosing class.
Substitute symbols in to
for corresponding occurrences of references to
symbols from
in this type.
Substitute symbols in to
for corresponding occurrences of references to
symbols from
in this type.
Substitute given tree to
for occurrences of nodes that represent
C.this
, where C
referes to the given class clazz
.
Substitute given tree to
for occurrences of nodes that represent
C.this
, where C
referes to the given class clazz
.
Substitute types in to
for corresponding occurrences of references to
symbols from
in this tree.
Substitute types in to
for corresponding occurrences of references to
symbols from
in this tree.
Symbol of the tree.
Symbol of the tree.
For most trees symbol is null
. In SymTree
s,
it is overridden and implemented with a var, initialized to NoSymbol
.
Trees which are not SymTree
s but which carry symbols do so by
overriding def symbol
to forward it elsewhere. Examples:
Super(qual, _)
has qual
's symbol,Apply(fun, args)
has fun
's symbol,TypeApply(fun, args)
has fun
's symbol,AppliedTypeTree(tpt, args)
has tpt
's symbol,TypeTree(tpe)
has tpe
's typeSymbol
, if tpe != null
.
Type of the tree.
Type of the tree.
Upon creation most trees have their tpe
set to null
.
Types are typically assigned to trees during typechecking.
Some node factory methods set tpe
immediately after creation.
When the typechecker encounters a tree with a non-null tpe,
it will assume it to be correct and not check it again. This means one has
to be careful not to erase the tpe
field of subtrees.
Find all subtrees matching predicate p
.
Find all subtrees matching predicate p
. Same as filter
Returns string formatted according to given format
string.
Returns string formatted according to given format
string.
Format strings are as for String.format
(@see java.lang.String.format).
An iterator over all the elements of this product.
An iterator over all the elements of this product.
in the default implementation, an Iterator[Any]
A string used in the toString
methods of derived classes.
A string used in the toString
methods of derived classes.
Implementations may override this method to prepend a string prefix
to the result of toString
methods.
in the default implementation, the empty string
Obtains string representation of a tree
Obtains string representation of a tree
The API that all thises support