Dotty Documentation

0.14.0-bin-SNAPSHOT

class TailRecElimination
extends TreeMap

[-] Constructors

TailRecElimination ( method: Symbol , enclosingClass: ClassSymbol , paramSyms: List [ Symbol ] , isMandatory: Boolean )

[-] Members

[+] private val enclosingClass : ClassSymbol
[+] var failureReported : Boolean
[+] private var inTailPosition : Boolean
[+] private val isMandatory : Boolean
[+] private val method : Symbol
[+] private var myContinueLabel : Symbol

The tailLabelN label symbol, used to encode a continue from the infinite while loop.

[+] private val paramSyms : List [ Symbol ]
[+] var rewrittenParamSyms : List [ Symbol ]

The subset of paramSyms that are modified in at least one recursive call, and which therefore need a replacement var.

[+] var rewrote : Boolean
[+] private val tailPositionLabeledSyms : HashSet [ Symbol ]

Symbols of Labeled blocks that are in tail position.

[+] var varForRewrittenThis : Option [ Symbol ]

The local var that replaces this, if it is modified in at least one recursive call.

[+] var varsForRewrittenParamSyms : List [ Symbol ]

The replacement vars for the params in rewrittenParamSyms.

[+] def continueLabel ( implicit ctx: Context ) : Symbol
[+] def failureReported_= ( x$1: Boolean ) : Unit
[+] private def getVarForRewrittenParam ( param: Symbol ) ( implicit ctx: Context ) : Symbol
[+] private def getVarForRewrittenThis ( ) ( implicit ctx: Context ) : Symbol
[+] private def isTraversalNeeded : Boolean

If not in tail position a tree traversal may not be needed.

A recursive call may still be in tail position if within the return expression of a labeled block. A tree traversal may also be needed to report a failure to transform a recursive call of a @tailrec annotated method (i.e. isMandatory).

[+] def noTailTransform ( tree: Tree ) ( implicit ctx: Context ) : Tree
[+] def noTailTransforms ( trees: List [ Tr ] ) ( implicit ctx: Context ) : List [ Tr ]
[+] def rewrittenParamSyms_= ( x$1: List [ Symbol ] ) : Unit

The subset of paramSyms that are modified in at least one recursive call, and which therefore need a replacement var.

[+] def rewrote_= ( x$1: Boolean ) : Unit
[+] def transform ( tree: Tree , tailPosition: Boolean ) ( implicit ctx: Context ) : Tree

Rewrite this tree to contain no tail recursive calls

[+] override def transform ( tree: Tree ) ( implicit ctx: Context ) : Tree
[+] def varForRewrittenThis_= ( x$1: Option [ Symbol ] ) : Unit

The local var that replaces this, if it is modified in at least one recursive call.

[+] def varsForRewrittenParamSyms_= ( x$1: List [ Symbol ] ) : Unit

The replacement vars for the params in rewrittenParamSyms.

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