Dotty Documentation

0.4.0-bin-SNAPSHOT

trait TypedTreeInfo
extends TreeInfo

[-] Constructors

[-] Members

[+] class StructuralEqDeco

Structural tree comparison (since == on trees is reference equality). For the moment, only Ident, Select, Literal, Apply and TypeApply are supported

[+] object closure

An extractor for closures, either contained in a block or standalone.

[+] def closureBody ( tree: Tree ) ( implicit ctx: Context ) : Tree

If tree is a closure, its body, otherwise tree itself

[+] def constToLiteral ( tree: Tree ) ( implicit ctx: Context ) : Tree

If tree is a constant expression, its value as a Literal, or tree itself otherwise.

Note: Demanding idempotency instead of purity in literalize is strictly speaking too loose. Example

object O { final val x = 42; println("43") } O.x

Strictly speaking we can't replace O.x with 42. But this would make most expressions non-constant. Maybe we can change the spec to accept this kind of eliding behavior. Or else enforce true purity in the compiler. The choice will be affected by what we will do with inline and with Singleton type bounds (see SIP 23). Presumably

object O1 { val x: Singleton = 42; println("43") } object O2 { inline val x = 42; println("43") }

should behave differently.

O1.x should have the same effect as { println("43"); 42 }

whereas

O2.x = 42

Revisit this issue once we have implemented inline. Then we can demand purity of the prefix unless the selection goes to an inline val.

Note: This method should be applied to all term tree nodes that are not literals, that can be idempotent, and that can have constant types. So far, only nodes of the following classes qualify:

  Ident
  Select
  TypeApply
[+] def decomposeCall ( tree: Tree ) : ( Tree, List [ Tree ], List [ List [ Tree ] ] )

Decompose a call fntargs...(vargs_n) into its constituents (where targs, vargss may be empty)

[+] def defKind ( tree: Tree ) : FlagSet

The largest subset of {NoInits, PureInterface} that a trait enclosing this statement can have as flags.

[+] def defPath ( sym: Symbol , root: Tree ) ( implicit ctx: Context ) : List [ Tree ]

Going from child to parent, the path of tree nodes that starts with a definition of symbol sym and ends with root, or Nil if no such path exists. Pre: sym must have a position.

[+] def definedSym ( tree: Tree ) ( implicit ctx: Context ) : Symbol

If tree is a DefTree, the symbol defined by it, otherwise NoSymbol

[+] def definingStats ( sym: Symbol ) ( implicit ctx: Context ) : List [ Tree ]

The statement sequence that contains a definition of sym, or Nil if none was found. For a tree to be found, The symbol must have a position and its definition tree must be reachable from come tree stored in an enclosing context.

[+] private def exprPurity ( tree: Tree ) ( implicit ctx: Context ) : PurityLevel

The purity level of this expression.

[+] def isCatchCase ( cdef: CaseDef ) ( implicit ctx: Context ) : Boolean

Is this pattern node a catch-all or type-test pattern?

[+] def isIdempotentExpr ( tree: Tree ) ( implicit ctx: Context ) : Boolean
[+] def isIdempotentRef ( tree: Tree ) ( implicit ctx: Context ) : Boolean
[+] def isPureExpr ( tree: Tree ) ( implicit ctx: Context ) : Boolean
[+] def isPureRef ( tree: Tree ) ( implicit ctx: Context ) : Boolean
[+] def isSelf ( tree: Tree , enclClass: Symbol ) ( implicit ctx: Context ) : Boolean

Is tree a this node which belongs to enclClass?

[+] private def isSimpleThrowable ( tp: Type ) ( implicit ctx: Context ) : Boolean
[+] def isStructuralTermSelect ( tree: Tree ) ( implicit ctx: Context ) : Boolean

Is this a selection of a member of a structural type that is not a member of an underlying class or trait?

[+] def isSyntheticApply ( tree: Tree ) : Boolean

Is tree a compiler-generated .apply node that refers to the apply of a function class?

[+] def isVariableOrGetter ( tree: Tree ) ( implicit ctx: Context ) : Boolean

Is tree a reference to a mutable variable, or to a potential getter that has a setter in the same class?

[+] def localSyms ( stats: List [ Tree ] ) ( implicit ctx: Context ) : List [ Symbol ]

The symbols defined locally in a statement list

[+] def mayBeVarGetter ( sym: Symbol ) ( implicit ctx: Context ) : Boolean

Is symbol potentially a getter of a mutable variable?

[+] private def minOf ( l0: PurityLevel , ls: List [ PurityLevel ] ) : PurityLevel
[+] def patVars ( tree: Tree ) ( implicit ctx: Context ) : List [ Symbol ]

The variables defined by a pattern, in reverse order of their appearance.

[+] private def refPurity ( tree: Tree ) ( implicit ctx: Context ) : PurityLevel
[+] def sliceTopLevel ( tree: Tree , cls: ClassSymbol ) ( implicit ctx: Context ) : List [ Tree ]

The tree containing only the top-level classes and objects matching either cls or its companion object

[+] private def statPurity ( tree: Tree ) ( implicit ctx: Context ) : PurityLevel

The purity level of this statement.

[+] def stripCast ( tree: Tree ) ( implicit ctx: Context ) : Tree

Strips layers of .asInstanceOf[T] / _.$asInstanceOf[T]() from an expression

[+] def topLevelClasses ( tree: Tree ) ( implicit ctx: Context ) : List [ ClassSymbol ]

The top level classes in this tree, including only those module classes that are not a linked class of some other class in the result.