trait Trees extends AnyRef
- Alphabetic
- By Inheritance
- Trees
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
- abstract class AbsModifiers extends AnyRef
-
case class
Alternative
(trees: List[Universe.Tree]) extends Universe.Tree with Universe.TermTree with Product with Serializable
Alternatives of patterns, eliminated by explicitouter, except for occurrences in encoded Switch stmt (=remaining Match(CaseDef(...))
-
case class
Annotated
(annot: Universe.Tree, arg: Universe.Tree) extends Universe.Tree with Product with Serializable
A tree that has an annotation attached to it.
A tree that has an annotation attached to it. Only used for annotated types and annotation ascriptions, annotations on definitions are stored in the Modifiers. Eliminated by typechecker (typedAnnotated), the annotations are then stored in an AnnotatedType.
- abstract type AnnotationType
- case class AnonFunc (vparamss: List[List[Universe.ValDef]], tpt: Universe.Tree, rhs: Universe.Tree) extends Universe.Tree with Universe.FuncTree with Product with Serializable
-
case class
AppliedTypeTree
(tpt: Universe.Tree, args: List[Universe.Tree]) extends Universe.Tree with Universe.TypTree with Product with Serializable
Applied type <tpt> [ <args> ], eliminated by RefCheck
-
case class
Apply
(fun: Universe.Tree, args: List[Universe.Tree]) extends Universe.GenericApply with Product with Serializable
Value application
-
case class
ApplyDynamic
(qual: Universe.Tree, args: List[Universe.Tree]) extends Universe.Tree with Universe.TermTree with Universe.SymTree with Product with Serializable
Dynamic value application.
Dynamic value application. In a dynamic application q.f(as)
- q is stored in qual
- as is stored in args
- f is stored as the node's symbol field.
- class ApplyImplicitView extends Universe.Apply
- class ApplyToImplicitArgs extends Universe.Apply
-
case class
ArrayValue
(elemtpt: Universe.Tree, elems: List[Universe.Tree]) extends Universe.Tree with Universe.TermTree with Product with Serializable
Array of expressions, needs to be translated in backend,
-
case class
Assign
(lhs: Universe.Tree, rhs: Universe.Tree) extends Universe.Tree with Universe.TermTree with Product with Serializable
Assignment
- class BackQuotedIdent extends Universe.Ident
-
case class
Bind
(name: Universe.Name, body: Universe.Tree) extends Universe.DefTree with Product with Serializable
Bind of a variable to a rhs pattern, eliminated by explicitouter
-
case class
Block
(stats: List[Universe.Tree], expr: Universe.Tree) extends Universe.Tree with Universe.TermTree with Product with Serializable
Block of expressions (semicolon separated expressions)
-
case class
CaseDef
(pat: Universe.Tree, guard: Universe.Tree, body: Universe.Tree) extends Universe.Tree with Product with Serializable
Case clause in a pattern match, eliminated during explicitouter (except for occurrences in switch statements)
-
case class
ClassDef
(mods: Universe.Modifiers, ctormods: Universe.Modifiers, name: Universe.TypeName, tparams: List[Universe.TypeDef], vparams: List[Universe.ValDef], impl: Universe.Template) extends Universe.ImplDef with Product with Serializable
A class definition.
-
case class
Commented
(mods: Universe.Modifiers, comment: List[String], expr: Universe.Tree) extends Universe.Tree with Product with Serializable
Commented expression
-
case class
CompoundTypeTree
(templ: Universe.Template) extends Universe.Tree with Universe.TypTree with Product with Serializable
Intersection type <parent1> with ...
Intersection type <parent1> with ... with <parentN> { <decls> }, eliminated by RefCheck
-
case class
DefDef
(mods: Universe.Modifiers, name: Universe.Name, tparams: List[Universe.TypeDef], vparamss: List[List[Universe.ValDef]], tpt: Universe.Tree, rhs: Universe.Tree) extends Universe.ValOrDefDef with Product with Serializable
A method or macro definition.
A method or macro definition.
- name
The name of the method or macro. Can be a type name in case this is a type macro
-
abstract
class
DefTree
extends Universe.Tree with Universe.SymTree
A tree which defines a symbol-carrying entity.
- sealed trait Enumerator extends Universe.Tree
- case class ExistentialTypeTree (tpt: Universe.Tree, whereClauses: List[Universe.Tree]) extends Universe.Tree with Universe.TypTree with Product with Serializable
- class FilterTreeTraverser extends Universe.Traverser
- class FindTreeTraverser extends Universe.Traverser
- case class ForFilter (pos: Position, test: Universe.Tree) extends Universe.Tree with Universe.Enumerator with Product with Serializable
- case class ForTree (enums: List[Universe.Enumerator], body: Universe.Tree) extends Universe.Tree with Product with Serializable
- case class ForValDef (pos: Position, name: Universe.TermName, tpt: Universe.Tree, rhs: Universe.Tree) extends Universe.ValOrDefDef with Universe.Enumerator with Product with Serializable
- case class ForValFrom (pos: Position, name: Universe.TermName, tpt: Universe.Tree, rhs: Universe.Tree) extends Universe.ValOrDefDef with Universe.Enumerator with Product with Serializable
- case class ForYieldTree (enums: List[Universe.Enumerator], body: Universe.Tree) extends Universe.Tree with Product with Serializable
- class ForeachTreeTraverser extends Universe.Traverser
-
trait
FuncTree
extends Universe.Tree with Universe.TermTree
A tree for a function expression.
-
case class
Function
(vparams: List[Universe.ValDef], body: Universe.Tree) extends Universe.Tree with Universe.TermTree with Universe.SymTree with Product with Serializable
Anonymous function, eliminated by analyzer
-
abstract
class
GenericApply
extends Universe.Tree with Universe.TermTree
Common base class for Apply and TypeApply.
Common base class for Apply and TypeApply. This could in principle be a SymTree, but whether or not a Tree is a SymTree isn't used to settle any interesting questions, and it would add a useless field to all the instances (useless, since GenericApply forwards to the underlying fun.)
-
case class
Ident
(name: Universe.Name) extends Universe.Tree with Universe.RefTree with Product with Serializable
Identifier <name>
-
case class
If
(cond: Universe.Tree, thenp: Universe.Tree, elsep: Universe.Tree) extends Universe.Tree with Universe.TermTree with Product with Serializable
Conditional expression
-
abstract
class
ImplDef
extends Universe.MemberDef
A common base class for class and object definitions.
-
case class
Import
(expr: Universe.Tree, selectors: List[Universe.ImportSelector]) extends Universe.Tree with Universe.SymTree with Product with Serializable
Import clause
-
case class
ImportSelector
(name: Universe.Name, namePos: Int, rename: Universe.Name, renamePos: Int) extends Product with Serializable
Import selector
Import selector
Representation of an imported name its optional rename and their optional positions
- name
the imported name
- namePos
its position or -1 if undefined
- rename
the name the import is renamed to (== name if no renaming)
- renamePos
the position of the rename or -1 if undefined
-
case class
Infix
(qualifier: Universe.Tree, name: Universe.Name, args: List[Universe.Tree]) extends Universe.Tree with Product with Serializable
Infix application
-
case class
InfixUnApply
(qualifier: Universe.Tree, name: Universe.Name, args: List[Universe.Tree]) extends Universe.Tree with Product with Serializable
Infix extraction, for example
case x :: rest
- case class Interpolated (interpolator: Universe.Name, args: List[Universe.Tree]) extends Universe.Tree with Product with Serializable
-
case class
LabelDef
(name: Universe.TermName, param: Universe.Tree, rhs: Universe.Tree) extends Universe.DefTree with Universe.TermTree with Product with Serializable
A labelled expression.
A labelled expression. Not expressible in language syntax, but generated by the compiler to simulate while/do-while loops, and also by the pattern matcher.
The label acts much like a nested function, where
params
represents the incoming parameters. The symbol given to the LabelDef should have a MethodType, as if it were a nested function.Jumps are apply nodes attributed with a label's symbol. The arguments from the apply node will be passed to the label and assigned to the Idents.
Forward jumps within a block are allowed.
- class LazyTreeCopier extends Universe.TreeCopierOps
-
case class
Literal
(value: Universe.Constant) extends Universe.Tree with Universe.TermTree with Product with Serializable
Literal
-
case class
Match
(selector: Universe.Tree, cases: List[Universe.CaseDef]) extends Universe.Tree with Universe.TermTree with Product with Serializable
- Pattern matching expression (before explicitouter)
- Pattern matching expression (before explicitouter)
- Switch statements (after explicitouter)
After explicitouter, cases will satisfy the following constraints:
- all guards are
EmptyTree
, - all patterns will be either
Literal(Constant(x:Int))
orAlternative(lit|...|lit)
- except for an "otherwise" branch, which has pattern
Ident(nme.WILDCARD)
-
abstract
class
MemberDef
extends Universe.DefTree
Common base class for all member definitions: types, classes, objects, packages, vals and vars, defs.
- abstract type Modifiers <: Universe.AbsModifiers
-
case class
ModuleDef
(mods: Universe.Modifiers, name: Universe.TermName, impl: Universe.Template) extends Universe.ImplDef with Product with Serializable
An object definition, e.g.
An object definition, e.g.
object Foo
. Internally, objects are quite frequently called modules to reduce ambiguity. -
case class
New
(tpt: Universe.Tree) extends Universe.Tree with Universe.TermTree with Product with Serializable
Object instantiation One should always use factory method below to build a user level new.
Object instantiation One should always use factory method below to build a user level new.
- tpt
a class type
-
case class
PackageDef
(mods: Universe.Modifiers, pid: Universe.RefTree, stats: List[Universe.Tree]) extends Universe.MemberDef with Product with Serializable
A packaging, such as
package pid { stats }
-
case class
ProcDef
(mods: Universe.Modifiers, name: Universe.Name, tparams: List[Universe.TypeDef], vparamss: List[List[Universe.ValDef]], rhs: Universe.Tree) extends Universe.MemberDef with Product with Serializable
A procedure definition.
A procedure definition. Sugar for a function whose return type is Unit.
- name
The name of the method or macro. Can be a type name in case this is a type macro
-
trait
RefTree
extends Universe.Tree with Universe.SymTree
A tree which references a symbol-carrying entity.
A tree which references a symbol-carrying entity. References one, as opposed to defining one; definitions are in DefTrees.
-
case class
Return
(expr: Universe.Tree) extends Universe.Tree with Universe.TermTree with Universe.SymTree with Product with Serializable
Return expression
-
case class
Select
(qualifier: Universe.Tree, name: Universe.Name) extends Universe.Tree with Universe.RefTree with Product with Serializable
Designator <qualifier> .
Designator <qualifier> . <name>
-
case class
SelectFromTypeTree
(qualifier: Universe.Tree, name: Universe.TypeName) extends Universe.Tree with Universe.TypTree with Universe.RefTree with Product with Serializable
Type selection <qualifier> # <name>, eliminated by RefCheck
-
case class
SingletonTypeTree
(ref: Universe.Tree) extends Universe.Tree with Universe.TypTree with Product with Serializable
Singleton type, eliminated by RefCheck
-
case class
Star
(elem: Universe.Tree) extends Universe.Tree with Universe.TermTree with Product with Serializable
Repetition of pattern, eliminated by explicitouter
- class StrictTreeCopier extends Universe.TreeCopierOps
-
case class
Super
(qual: Universe.Tree, mix: Universe.TypeName) extends Universe.Tree with Universe.TermTree with Product with Serializable
Super reference, qual = corresponding this reference
-
trait
SymTree
extends Universe.Tree
A tree with a mutable symbol field, initialized to NoSymbol.
-
case class
Template
(parents: List[Universe.Tree], self: Universe.ValDef, body: List[Universe.Tree]) extends Universe.Tree with Universe.SymTree with Product with Serializable
Instantiation template of a class or trait
-
trait
TermTree
extends Universe.Tree
A tree for a term.
A tree for a term. Not all terms are TermTrees; use isTerm to reliably identify terms.
-
case class
This
(qual: Universe.TypeName) extends Universe.Tree with Universe.TermTree with Universe.SymTree with Product with Serializable
Self reference
-
case class
Throw
(expr: Universe.Tree) extends Universe.Tree with Universe.TermTree with Product with Serializable
Throw expression
- class Traverser extends AnyRef
-
abstract
class
Tree
extends Product
Tree is the basis for scala's abstract syntax.
Tree is the basis for scala's abstract syntax. The nodes are implemented as case classes, and the parameters which initialize a given tree are immutable: however Trees have several mutable fields which are manipulated in the course of typechecking, including pos, symbol, and tpe.
Newly instantiated trees have tpe set to null (though it may be set immediately thereafter depending on how it is constructed.) When a tree is passed to the typer, typically via
typer.typed(tree)
, under normal circumstances the tpe must be null or the typer will ignore it. Furthermore, the typer is not required to return the same tree it was passed.Trees can be easily traversed with e.g. foreach on the root node; for a more nuanced traversal, subclass Traverser. Transformations can be considerably trickier: see the numerous subclasses of Transformer found around the compiler.
Copying Trees should be done with care depending on whether it need be done lazily or strictly (see LazyTreeCopier and StrictTreeCopier) and on whether the contents of the mutable fields should be copied. The tree copiers will copy the mutable attributes to the new tree; calling Tree#duplicate will copy symbol and tpe, but all the positions will be focused.
Trees can be coarsely divided into four mutually exclusive categories:
- TermTrees, representing terms
- TypTrees, representing types. Note that is
TypTree
, notTypeTree
. - SymTrees, which may represent types or terms.
- Other Trees, which have none of those as parents.
SymTrees include important nodes Ident and Select, which are used as both terms and types; they are distinguishable based on whether the Name is a TermName or TypeName. The correct way for to test for a type or a term (on any Tree) are the isTerm/isType methods on Tree.
"Others" are mostly syntactic or short-lived constructs. Examples include CaseDef, which wraps individual match cases: they are neither terms nor types, nor do they carry a symbol. Another example is Parens, which is eliminated during parsing.
- abstract type TreeCopier <: Universe.TreeCopierOps
- trait TreeCopierOps extends AnyRef
- case class Try (block: Universe.Tree, catches: List[Universe.CaseDef], finalizer: Universe.Tree) extends Universe.Tree with Universe.TermTree with Product with Serializable
-
trait
TypTree
extends Universe.Tree
A tree for a type.
A tree for a type. Not all types are TypTrees; use isType to reliably identify types.
-
case class
TypeApply
(fun: Universe.Tree, args: List[Universe.Tree]) extends Universe.GenericApply with Product with Serializable
Explicit type application.
Explicit type application. All signs point toward it being a requirement that args.nonEmpty, but I can't find that explicitly stated anywhere. Unless your last name is odersky, you should probably treat it as true.
- case class TypeBoundsTree (lo: Universe.Tree, hi: Universe.Tree) extends Universe.Tree with Universe.TypTree with Product with Serializable
-
case class
TypeDef
(mods: Universe.Modifiers, name: Universe.TypeName, tparams: List[Universe.TypeDef], rhs: Universe.Tree) extends Universe.MemberDef with Product with Serializable
An abstract type, a type parameter, or a type alias.
-
case class
TypeTree
() extends Universe.Tree with Universe.TypTree with Product with Serializable
A synthetic tree holding an arbitrary type.
A synthetic tree holding an arbitrary type. Not to be confused with with TypTree, the trait for trees that are only used for type trees. TypeTree's are inserted in several places, but most notably in
RefCheck
, where the arbitrary type trees are all replaced by TypeTree's. -
case class
Typed
(expr: Universe.Tree, tpt: Universe.Tree) extends Universe.Tree with Universe.TermTree with Product with Serializable
Type annotation, eliminated by explicit outer
- case class UnApply (fun: Universe.Tree, args: List[Universe.Tree]) extends Universe.Tree with Universe.TermTree with Product with Serializable
-
case class
ValDef
(mods: Universe.Modifiers, lhs: Universe.Tree, rhs: Universe.Tree) extends Universe.ValOrDefDef with Product with Serializable
A constant value definition (this includes vars as well, which differ from vals only in having the MUTABLE flag set in their Modifiers.)
-
abstract
class
ValOrDefDef
extends Universe.MemberDef
A common base class for ValDefs and DefDefs.
Abstract Value Members
- abstract def Modifiers(mods: Set[Modifier.Value] = Set(), privateWithin: Universe.Name = EmptyTypeName, annotations: List[Universe.AnnotationInfo] = List()): Universe.Modifiers
- abstract def emptyValDef: Universe.ValDef
- abstract def newLazyTreeCopier: Universe.TreeCopier
- abstract def newStrictTreeCopier: Universe.TreeCopier
Concrete Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def BackQuotedIdent(sym: Universe.Symbol): Universe.BackQuotedIdent
- def ForFilter(test: Universe.Tree): Universe.ForFilter
- def ForValDef(name: Universe.TermName, tpt: Universe.Tree, rhs: Universe.Tree): Universe.ForValDef
- def ForValFrom(name: Universe.TermName, tpt: Universe.Tree, rhs: Universe.Tree): Universe.ForValFrom
- def Ident(sym: Universe.Symbol): Universe.Ident
- def Infix(qualifier: Universe.Tree, sym: Universe.Symbol, args: List[Universe.Tree]): Universe.Infix
- def InfixUnApply(qualifier: Universe.Tree, sym: Universe.Symbol, args: List[Universe.Tree]): Universe.InfixUnApply
- def Interpolated(sym: Universe.Symbol, args: List[Universe.Tree]): Universe.Interpolated
- def Select(qualifier: Universe.Tree, sym: Universe.Symbol): Universe.Select
- def TypeTree(tp: Universe.Type): Universe.TypeTree
- def ValDef(mods: Universe.Modifiers, name: Universe.Name, tpt: Universe.Tree, rhs: Universe.Tree): Universe.ValDef
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
- val treeCopy: Universe.TreeCopier
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
def
xtraverse(traverser: Universe.Traverser, tree: Universe.Tree): Unit
- Attributes
- protected
- object BackQuotedIdent extends Serializable
-
object
EmptyTree
extends Universe.Tree with Universe.TermTree with Product with Serializable
The empty tree