TreeOps

dotty.tools.dotc.ast.tpd$.TreeOps
final implicit class TreeOps[ThisTree <: Tree](tree: ThisTree) extends AnyVal

Attributes

Graph
Supertypes
class AnyVal
trait Matchable
class Any

Members list

Concise view

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

Attributes

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

tree @annot

tree @annot

works differently for type trees and term trees

Attributes

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)

Attributes

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)

Attributes

An apply or type apply node with given argument list

An apply or type apply node with given argument list

Attributes

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))

Attributes

The current tree applied to (): tree()

The current tree applied to (): tree()

Attributes

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))

Attributes

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]

Attributes

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]

Attributes

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)]

Attributes

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]

Attributes

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

Attributes

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

tree.asInstanceOf[tp]

tree.asInstanceOf[tp]

Attributes

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.

Attributes

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

Attributes

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

Attributes

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

Attributes

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.

Attributes

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.

Attributes

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

Attributes

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.

Attributes

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

tree == that

tree == that

Attributes

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

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

Attributes

All subtrees of this tree that satisfy predicate p.

All subtrees of this tree that satisfy predicate p.

Attributes

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

Attributes

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

Attributes

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

Attributes

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.

Attributes

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

Attributes

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.

Attributes

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

A select node with the given type

A select node with the given type

Attributes

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.

Attributes

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

Attributes

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

Attributes

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

Attributes

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)

Attributes

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

Attributes

Replace Inlined nodes and InlineProxy references to underlying arguments

Replace Inlined nodes and InlineProxy references to underlying arguments

Attributes

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.

Attributes