TreeOps

final implicit class TreeOps[ThisTree <: Tree](tree: ThisTree) extends AnyVal
class AnyVal
trait Matchable
class Any

Value members

Concrete methods

def and(that: Tree)(using Context): Tree

this && that, for boolean trees this, that

this && that, for boolean trees this, that

def annotated(annot: Tree)(using Context): Tree

tree @annot

tree @annot

works differently for type trees and term trees

def appliedTo(arg: Tree)(using Context): Apply

A unary apply node with given argument: tree(arg)

A unary apply node with given argument: tree(arg)

def appliedTo(arg: Tree, args: Tree*)(using Context): Apply

An apply node with given arguments: tree(arg, args0, ..., argsN)

An apply node with given arguments: tree(arg, args0, ..., argsN)

An apply or type apply node with given argument list

An apply or type apply node with given argument list

def appliedToArgss(argss: List[List[Tree]])(using Context): Tree

The current tree applied to given argument lists: tree (argss(0)) ... (argss(argss.length -1))

The current tree applied to given argument lists: tree (argss(0)) ... (argss(argss.length -1))

The current tree applied to (): tree()

The current tree applied to (): tree()

An apply node with given argument list tree(args(0), ..., args(args.length - 1))

An apply node with given argument list tree(args(0), ..., args(args.length - 1))

def appliedToType(targ: Type)(using Context): Tree

The current tree applied to given type argument: tree[targ]

The current tree applied to given type argument: tree[targ]

def appliedToTypeTree(targ: Tree)(using Context): Tree

The current tree applied to given type argument: tree[targ]

The current tree applied to given type argument: tree[targ]

def appliedToTypeTrees(targs: List[Tree])(using Context): Tree

The current tree applied to given type argument list: tree[targs(0), ..., targs(targs.length - 1)]

The current tree applied to given type argument list: tree[targs(0), ..., targs(targs.length - 1)]

def appliedToTypes(targs: List[Type])(using Context): Tree

The current tree applied to given type arguments: tree[targ0, ..., targN]

The current tree applied to given type arguments: tree[targ0, ..., targN]

def appliedToVarargs(args: List[Tree], tpt: Tree)(using Context): Apply

An applied node that accepts only varargs as arguments

An applied node that accepts only varargs as arguments

def asInstance(tp: Type)(using Context): Tree

tree.asInstanceOf[tp]

tree.asInstanceOf[tp]

def becomes(rhs: Tree)(using Context): Tree

The translation of tree = rhs. This is either the tree as an assignment, or a setter call.

The translation of tree = rhs. This is either the tree as an assignment, or a setter call.

def cast(tp: Type)(using Context): Tree

cast tree to tp, assuming no exception is raised, i.e the operation is pure

cast tree to tp, assuming no exception is raised, i.e the operation is pure

def cast(tpt: TypeTree)(using Context): Tree

cast tree to tp, assuming no exception is raised, i.e the operation is pure

cast tree to tp, assuming no exception is raised, i.e the operation is pure

def changeNonLocalOwners(newOwner: Symbol)(using Context): Tree

Set the owner of every definition in this tree which is not itself contained in this tree to be newowner

Set the owner of every definition in this tree which is not itself contained in this tree to be newowner

def changeOwner(from: Symbol, to: Symbol)(using Context): ThisTree

Change owner from from to to. If from is a weak owner, also change its owner to to, and continue until a non-weak owner is reached.

Change owner from from to to. If from is a weak owner, also change its owner to to, and continue until a non-weak owner is reached.

def changeOwnerAfter(from: Symbol, to: Symbol, trans: DenotTransformer)(using Context): ThisTree

After phase trans, set the owner of every definition in this tree that was formerly owner by from to to.

After phase trans, set the owner of every definition in this tree that was formerly owner by from to to.

def deepFold[T](z: T)(op: (T, Tree) => T)(using Context): T

Apply to () unless tree's widened type is parameterless

Apply to () unless tree's widened type is parameterless

def ensureConforms(tp: Type)(using Context): Tree

cast tree to tp (or its box/unbox/cast equivalent when after erasure and value and non-value types are mixed), unless tree's type already conforms to tp.

cast tree to tp (or its box/unbox/cast equivalent when after erasure and value and non-value types are mixed), unless tree's type already conforms to tp.

def equal(that: Tree)(using Context): Tree

tree == that

tree == that

Is there a subtree of this tree that satisfies predicate p?

Is there a subtree of this tree that satisfies predicate p?

All subtrees of this tree that satisfy predicate p.

All subtrees of this tree that satisfy predicate p.

def find[T](pred: Tree => Boolean)(using Context): Option[Tree]
def foreachSubTree(f: Tree => Unit)(using Context): Unit

Apply f to each subtree of this tree

Apply f to each subtree of this tree

def isInstance(tp: Type)(using Context): Tree

tree.isInstanceOf[tp], with special treatment of singleton types

tree.isInstanceOf[tp], with special treatment of singleton types

def isValue(using Context): Boolean
def or(that: Tree)(using Context): Tree

this || that, for boolean trees this, that

this || that, for boolean trees this, that

def outerSelect(levels: Int, tp: Type)(using Context): Tree

A synthetic select with that will be turned into an outer path by ExplicitOuter.

A synthetic select with that will be turned into an outer path by ExplicitOuter.

Value parameters:
levels

How many outer levels to select

tp

The type of the destination of the outer path.

def select(name: Name)(using Context): Select

A select node with the given selector name and a computed type

A select node with the given selector name and a computed type

def select(name: Name, p: Symbol => Boolean)(using Context): Select

A select node with the given selector name such that the designated member satisfies predicate p. Useful for disambiguating overloaded members.

A select node with the given selector name such that the designated member satisfies predicate p. Useful for disambiguating overloaded members.

def select(tp: NamedType)(using Context): Select

A select node with the given type

A select node with the given type

def select(sym: Symbol)(using Context): Select

A select node that selects the given symbol. Note: Need to make sure this is in fact the symbol you would get when you select with the symbol's name, otherwise a data race may occur which would be flagged by -Yno-double-bindings.

A select node that selects the given symbol. Note: Need to make sure this is in fact the symbol you would get when you select with the symbol's name, otherwise a data race may occur which would be flagged by -Yno-double-bindings.

def selectWithSig(name: Name, sig: Signature, target: Name)(using Context): Tree

A select node with the given selector name and signature and a computed type

A select node with the given selector name and signature and a computed type

def selectWithSig(sym: Symbol)(using Context): Tree

A select node with selector name and signature taken from sym. Note: Use this method instead of select(sym) if the referenced symbol might be overridden in the type of the qualifier prefix. See note on select(sym: Symbol).

A select node with selector name and signature taken from sym. Note: Use this method instead of select(sym) if the referenced symbol might be overridden in the type of the qualifier prefix. See note on select(sym: Symbol).

def setDefTree(using Context): ThisTree

Set this tree as the defTree of its symbol and return this tree

Set this tree as the defTree of its symbol and return this tree

def shallowFold[T](z: T)(op: (T, Tree) => T)(using Context): T
def subst(from: List[Symbol], to: List[Symbol])(using Context): ThisTree

tree ne null (might need a cast to be type correct)

tree ne null (might need a cast to be type correct)

def underlying(using Context): Tree

Replace Ident nodes references to the underlying tree that defined them

Replace Ident nodes references to the underlying tree that defined them

Replace Inlined nodes and InlineProxy references to underlying arguments

Replace Inlined nodes and InlineProxy references to underlying arguments

If inititializer tree is _, the default value of its type, otherwise the tree itself.

If inititializer tree is _, the default value of its type, otherwise the tree itself.