Dotty Documentation

0.5.0-bin-SNAPSHOT

object Trees
extends Object

[-] Constructors

[-] Members

[+] case class Alternative

tree_1 | ... | tree_n

[+] object Alternative

tree_1 | ... | tree_n

[+] case class AndTypeTree

left & right

[+] object AndTypeTree

left & right

[+] case class Annotated

arg @annot

[+] object Annotated

arg @annot

[+] case class AppliedTypeTree

tpt[args]

[+] object AppliedTypeTree

tpt[args]

[+] case class Apply

fun(args)

[+] object Apply

fun(args)

[+] case class Assign

name = arg, outside a parameter list

[+] object Assign

name = arg, outside a parameter list

[+] class BackquotedIdent
[+] case class Bind

name @ body

[+] object Bind

name @ body

[+] case class Block

{ stats; expr }

[+] object Block

{ stats; expr }

[+] case class ByNameTypeTree

=> T

[+] object ByNameTypeTree

=> T

[+] case class CaseDef

case pat if guard => body; only appears as child of a Match

[+] object CaseDef

case pat if guard => body; only appears as child of a Match

[+] case class Closure

A closure with an environment and a reference to a method.

[+] object Closure

A closure with an environment and a reference to a method.

[+] case class DefDef

mods def nametparams...(vparams_n): tpt = rhs

[+] object DefDef

mods def nametparams...(vparams_n): tpt = rhs

[+] trait DefTree

Tree defines a new symbol

[+] abstract class DenotingTree

Tree's denotation can be derived from its type

[+] class EmptyValDef
[+] abstract class GenericApply
[+] case class Ident

name

[+] object Ident

name

[+] case class If

if cond then thenp else elsep

[+] object If

if cond then thenp else elsep

[+] case class Import

import expr.selectors where a selector is either an untyped Ident, name or an untyped thicket consisting of name and rename.

[+] object Import

import expr.selectors where a selector is either an untyped Ident, name or an untyped thicket consisting of name and rename.

[+] case class Inlined

A tree representing inlined code.

[+] object Inlined

A tree representing inlined code.

[+] abstract class Instance
[+] class JavaSeqLiteral

Array(elems)

[+] case class LambdaTypeTree

[typeparams] -> tpt

[+] object LambdaTypeTree

[typeparams] -> tpt

[+] trait Lazy

A base trait for lazy tree fields. These can be instantiated with Lazy instances which can delay tree construction until the field is first demanded.

[+] case class Literal

const

[+] object Literal

const

[+] case class Match

selector match { cases }

[+] object Match

selector match { cases }

[+] abstract class MemberDef

Tree defines a new symbol and carries modifiers. The position of a MemberDef contains only the defined identifier or pattern. The envelope of a MemberDef contains the whole definition and has its point on the opening keyword (or the next token after that if keyword is missing).

[+] abstract class NameTree

Tree has a name

[+] case class NamedArg

name = arg, in a parameter list

[+] object NamedArg

name = arg, in a parameter list

[+] case class New

new tpt, but no constructor call

[+] object New

new tpt, but no constructor call

[+] case class OrTypeTree

left | right

[+] object OrTypeTree

left | right

[+] case class PackageDef

package pid { stats }

[+] object PackageDef

package pid { stats }

[+] trait PatternTree

Instances of this class are trees which are not terms but are legal parts of patterns.

[+] abstract class ProxyTree

Tree's denot/isType/isTerm properties come from a subtree identified by forwardTo.

[+] abstract class RefTree

Tree refers by name to a denotation

[+] case class RefinedTypeTree

tpt { refinements }

[+] object RefinedTypeTree

tpt { refinements }

[+] case class Return

return expr where from refers to the method from which the return takes place After program transformations this is not necessarily the enclosing method, because closures can intervene.

[+] object Return

return expr where from refers to the method from which the return takes place After program transformations this is not necessarily the enclosing method, because closures can intervene.

[+] case class Select

qualifier.name, or qualifier#name, if qualifier is a type

[+] object Select

qualifier.name, or qualifier#name, if qualifier is a type

[+] class SelectWithSig
[+] case class SeqLiteral

Seq(elems)

[+] object SeqLiteral

Seq(elems)

[+] case class SingletonTypeTree

ref.type

[+] object SingletonTypeTree

ref.type

[+] case class Super

C.super[mix], where qual = C.this

[+] object Super

C.super[mix], where qual = C.this

[+] case class Template

extends parents { self => body }

[+] object Template

extends parents { self => body }

[+] trait TermTree

Instances of this class are trees for which isTerm is definitely true. Note that some trees have isTerm = true without being TermTrees (e.g. Ident, AnnotatedTree)

[+] case class Thicket

Temporary class that results from translation of ModuleDefs (and possibly other statements). The contained trees will be integrated when transformed with a transform(List[Tree]) call.

[+] object Thicket

Temporary class that results from translation of ModuleDefs (and possibly other statements). The contained trees will be integrated when transformed with a transform(List[Tree]) call.

[+] case class This

qual.this

[+] object This

qual.this

[+] abstract class Tree

Trees take a parameter indicating what the type of their tpe field is. Two choices: Type or Untyped. Untyped trees have type Tree[Untyped].

Tree typing uses a copy-on-write implementation:

  • You can never observe a tpe which is null (throws an exception)
  • So when creating a typed tree with withType we can re-use the existing tree transparently, assigning its tpe field, provided it was null before.
  • It is impossible to embed untyped trees in typed ones.
  • Typed trees can be embedded in untyped ones provided they are rooted in a TypedSplice node.
  • Type checking an untyped tree should remove all embedded TypedSplice nodes.
[+] case class Try

try block catch handler finally finalizer

Note: if the handler is a case block CASES of the form

{ case1 ... caseN }

the parser returns Match(EmptyTree, CASES). Desugaring and typing this yields a closure node

{ def $anonfun(x: Throwable) = x match CASES; Closure(Nil, $anonfun) }

At some later stage when we normalize the try we can revert this to

Match(EmptyTree, CASES)

or else if stack is non-empty

Match(EmptyTree, <case x: Throwable => $anonfun(x)>)

[+] object Try

try block catch handler finally finalizer

Note: if the handler is a case block CASES of the form

{ case1 ... caseN }

the parser returns Match(EmptyTree, CASES). Desugaring and typing this yields a closure node

{ def $anonfun(x: Throwable) = x match CASES; Closure(Nil, $anonfun) }

At some later stage when we normalize the try we can revert this to

Match(EmptyTree, CASES)

or else if stack is non-empty

Match(EmptyTree, <case x: Throwable => $anonfun(x)>)

[+] trait TypTree

Instances of this class are trees for which isType is definitely true. Note that some trees have isType = true without being TypTrees (e.g. Ident, AnnotatedTree)

[+] case class TypeApply

fun[args]

[+] object TypeApply

fun[args]

[+] case class TypeBoundsTree

: lo <: hi

[+] object TypeBoundsTree

: lo <: hi

[+] case class TypeDef

mods class name template or mods trait name template or mods type name = rhs or mods type name >: lo <: hi, if rhs = TypeBoundsTree(lo, hi) & (lo ne hi)

[+] object TypeDef

mods class name template or mods trait name template or mods type name = rhs or mods type name >: lo <: hi, if rhs = TypeBoundsTree(lo, hi) & (lo ne hi)

[+] case class TypeTree

A type tree that represents an existing or inferred type

[+] object TypeTree

A type tree that represents an existing or inferred type

[+] case class Typed

expr : tpt

[+] object Typed

expr : tpt

[+] case class UnApply

The typed translation of extractor(patterns) in a pattern. The translation has the following components:

[+] object UnApply

The typed translation of extractor(patterns) in a pattern. The translation has the following components:

[+] case class ValDef

mods val name: tpt = rhs

[+] object ValDef

mods val name: tpt = rhs

[+] trait ValOrDefDef

A ValDef or DefDef tree

[+] trait WithLazyField

A tree that can have a lazy field The field is represented by some private var which is proxied unforced and force. Forcing the field will set the var to the underlying value.

[+] trait WithoutTypeOrPos
[+] type LazyTree = AnyRef
[+] type LazyTreeList = AnyRef
[+] type Untyped = Null
[+] val DocComment : Key [ Comment ]

Property key for trees with documentation strings attached

[+] @sharable private var nextId : Int
[+] @sharable var ntrees : Int

The total number of created tree nodes, maintained if Stats.enabled

[+] @sharable val theEmptyTree : Thicket [ Type ]
[+] @sharable val theEmptyValDef : EmptyValDef [ Type ]
[+] def flatten ( trees: List [ Tree [ T ] ] ) : List [ Tree [ T ] ]
[+] def genericEmptyTree : Thicket [ T ]
[+] def genericEmptyValDef : ValDef [ T ]
[+] @sharable def ntrees_= ( x$1: Int ) : Unit

The total number of created tree nodes, maintained if Stats.enabled