Dotty Documentation

0.5.0-bin-SNAPSHOT

class FirstTransform
extends MiniPhase with InfoTransformer

The first tree transform - ensures there are companion objects for all classes except module classes - eliminates some kinds of trees: Imports, NamedArgs - stubs out native methods - eliminates self tree in Template and self symbol in ClassInfo - collapses all type trees to trees of class TypeTree - converts idempotent expressions with constant types - drops branches of ifs using the rules if (true) A else B ==> A if (false) A else B ==> B

[-] Constructors

FirstTransform ( )

[-] Members

[+] private var addCompanionPhases : List [ NeedsCompanions ]
[+] override def changesMembers : Boolean

Can this transform create or delete non-private members?

[+] override def checkPostCondition ( tree: Tree ) ( implicit ctx: Context ) : Unit

Check what the phase achieves, to be called at any point after it is finished.

[+] private def foldCondition ( tree: Apply ) ( implicit ctx: Context ) : Tree [ Type ]

Perform one of the following simplification if applicable:

true  && y   ==>  y
false && y   ==>  false
true  || y   ==>  true
false || y   ==>  y
[+] def needsCompanion ( cls: ClassSymbol ) ( implicit ctx: Context ) : Boolean
[+] private def newCompanion ( name: TermName , forClass: Symbol ) ( implicit ctx: Context ) : ( TermSymbol, Symbol, Symbol )
[+] override def phaseName : String

A name given to the Phase that can be used to debug the compiler. For instance, it is possible to print trees after a given phase using:

$ ./bin/dotc -Xprint:<phaseNameHere> sourceFile.scala
[+] override def prepareForUnit ( tree: Tree ) ( implicit ctx: Context ) : Context
[+] private def reorderAndComplete ( stats: List [ Tree ] ) ( implicit ctx: Context ) : List [ Tree ]

Reorder statements so that module classes always come after their companion classes, add missing companion classes

[+] override def transformApply ( tree: Apply ) ( implicit ctx: Context ) : Tree
[+] override def transformBlock ( tree: Block ) ( implicit ctx: Context ) : Tree
[+] override def transformDefDef ( ddef: DefDef ) ( implicit ctx: Context ) : Tree
[+] override def transformIdent ( tree: Ident ) ( implicit ctx: Context ) : Tree
[+] override def transformIf ( tree: If ) ( implicit ctx: Context ) : Tree
[+] override def transformInfo ( tp: Type , sym: Symbol ) ( implicit ctx: Context ) : Type

eliminate self symbol in ClassInfo

[+] override def transformOther ( tree: Tree ) ( implicit ctx: Context ) : Tree
[+] override def transformPackageDef ( tree: PackageDef ) ( implicit ctx: Context ) : Tree

Eliminate empty package definitions that may have been stored in the TASTY trees

[+] override def transformSelect ( tree: Select ) ( implicit ctx: Context ) : Tree
[+] override def transformStats ( trees: List [ Tree ] ) ( implicit ctx: Context ) : List [ Tree ]
[+] override def transformTemplate ( impl: Template ) ( implicit ctx: Context ) : Tree
[+] override def transformTypeApply ( tree: TypeApply ) ( implicit ctx: Context ) : Tree
[+] override def transformTyped ( tree: Typed ) ( implicit ctx: Context ) : Tree
[+] override def transformValDef ( vdef: ValDef ) ( implicit ctx: Context ) : Tree