dotty.tools.dotc.transform

LambdaLift

Related Docs: object LambdaLift | package transform

class LambdaLift extends DotClass with MiniPhase with IdentityDenotTransformer

This phase performs the necessary rewritings to eliminate classes and methods nested in other methods. In detail:

  1. It adds all free variables of local functions as additional parameters (proxies). 2. It rebinds references to free variables to the corresponding proxies, 3. It lifts all local functions and classes out as far as possible, but at least to the enclosing class. 4. It stores free variables of non-trait classes as additional fields of the class. The fields serve as proxies for methods in the class, which avoids the need of passing additional parameters to these methods.

A particularly tricky case are local traits. These cannot store free variables as field proxies, because LambdaLift runs after Mixin, so the fields cannot be expanded anymore. Instead, methods of local traits get free variables of the trait as additional proxy parameters. The difference between local classes and local traits is illustrated by the two rewritings below.

def f(x: Int) = { def f(x: Int) = new C(x).f2 class C { ==> class C(x$1: Int) { def f2 = x def f2 = x$1 } } new C().f2 }

def f(x: Int) = { def f(x: Int) = new C().f2(x) trait T { ==> trait T def f2 = x def f2(x$1: Int) = x$1 } } class C extends T class C extends T new C().f2 }

Self Type
LambdaLift
Linear Supertypes
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. LambdaLift
  2. IdentityDenotTransformer
  3. DenotTransformer
  4. MiniPhase
  5. Phase
  6. DotClass
  7. AnyRef
  8. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new LambdaLift()

Type Members

  1. class LambdaLifter extends TreeTransform

Value Members

  1. final def !=(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Definition Classes
    AnyRef → Any
  3. final def <=(that: Phase): Boolean

    Definition Classes
    Phase
  4. final def ==(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  5. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  6. def checkPostCondition(tree: ast.tpd.Tree)(implicit ctx: Context): Unit

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

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

    Definition Classes
    Phase
  7. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  8. def description: String

    Definition Classes
    Phase
  9. def end: PhaseId

    Definition Classes
    Phase
  10. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  11. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  12. final def erasedTypes: Boolean

    Definition Classes
    Phase
  13. def exists: Boolean

    Definition Classes
    Phase
  14. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  15. final def flatClasses: Boolean

    Definition Classes
    Phase
  16. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  17. final def hasNext: Boolean

    Definition Classes
    Phase
  18. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  19. def id: Int

    The sequence position of this phase in the given context where 0 is reserved for NoPhase and the first real phase is at position 1.

    The sequence position of this phase in the given context where 0 is reserved for NoPhase and the first real phase is at position 1. -1 if the phase is not installed in the context.

    Definition Classes
    Phase
  20. var idx: Int

    id of this mini phase in group

    id of this mini phase in group

    Definition Classes
    MiniPhase
  21. def init(base: ContextBase, id: Int): Unit

    Attributes
    protected[dotty.tools.dotc.core.Phases]
    Definition Classes
    Phase
  22. def init(base: ContextBase, start: Int, end: Int): Unit

    Attributes
    protected[dotty.tools.dotc.core.Phases]
    Definition Classes
    Phase
  23. def isCheckable: Boolean

    Output should be checkable by TreeChecker

    Output should be checkable by TreeChecker

    Definition Classes
    Phase
  24. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  25. def isTyper: Boolean

    Is this phase the standard typerphase? True for FrontEnd, but not for other first phases (such as FromTasty).

    Is this phase the standard typerphase? True for FrontEnd, but not for other first phases (such as FromTasty). The predicate is tested in some places that perform checks and corrections. It's different from isAfterTyper (and cheaper to test).

    Definition Classes
    Phase
  26. final def iterator: Iterator[Phase]

    Definition Classes
    Phase
  27. final def labelsReordered: Boolean

    Definition Classes
    Phase
  28. def lastPhaseId(implicit ctx: Context): Int

    The last phase during which the transformed denotations are valid

    The last phase during which the transformed denotations are valid

    Definition Classes
    DenotTransformer
  29. def mkTreeTransformer: TreeTransformer

    Attributes
    protected
    Definition Classes
    MiniPhase
  30. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  31. final def next: Phase

    Definition Classes
    Phase
  32. final def notify(): Unit

    Definition Classes
    AnyRef
  33. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  34. def period: Period

    Definition Classes
    Phase
  35. val phaseName: String

    the following two members override abstract members in Transform

    the following two members override abstract members in Transform

    Definition Classes
    LambdaLiftPhase
  36. final def prev: Phase

    Definition Classes
    Phase
  37. final def refChecked: Boolean

    Definition Classes
    Phase
  38. def relaxedTyping: Boolean

    If set, allow missing or superfluous arguments in applications and type applications.

    If set, allow missing or superfluous arguments in applications and type applications.

    Definition Classes
    LambdaLiftPhase
  39. def run(implicit ctx: Context): Unit

    Definition Classes
    MiniPhasePhase
  40. def runOn(units: List[CompilationUnit])(implicit ctx: Context): List[CompilationUnit]

    Definition Classes
    Phase
  41. def runsAfter: Set[Class[_ <: Phase]]

    List of names of phases that should precede this phase

    List of names of phases that should precede this phase

    Definition Classes
    LambdaLiftPhase
  42. def runsAfterGroupsOf: Set[Class[_ <: Phase]]

    List of names of phases that should have finished their processing of all compilation units before this phase starts

    List of names of phases that should have finished their processing of all compilation units before this phase starts

    Definition Classes
    MiniPhase
  43. def start: Int

    Definition Classes
    Phase
  44. final def symbolicRefs: Boolean

    Definition Classes
    Phase
  45. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  46. def toString(): String

    Definition Classes
    Phase → AnyRef → Any
  47. def transform(ref: SingleDenotation)(implicit ctx: Context): SingleDenotation

    The transformation method

    The transformation method

    Definition Classes
    IdentityDenotTransformerDenotTransformer
  48. val treeTransform: LambdaLifter

    Definition Classes
    LambdaLiftMiniPhase
  49. def unsupported(methodName: String): Nothing

    Throws an UnsupportedOperationException with the given method name.

    Throws an UnsupportedOperationException with the given method name.

    Definition Classes
    DotClass
  50. def validFor(implicit ctx: Context): Period

    The validity period of the transformer in the given context

    The validity period of the transformer in the given context

    Definition Classes
    DenotTransformer
  51. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  52. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  53. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from IdentityDenotTransformer

Inherited from DenotTransformer

Inherited from MiniPhase

Inherited from Phase

Inherited from DotClass

Inherited from AnyRef

Inherited from Any

Ungrouped