Lifter

abstract class Lifter

A class that handles argument lifting. Argument lifting is needed in the following scenarios:

  • eta expansion
  • applications with default arguments
  • applications with out-of-order named arguments Lifting generally lifts impure expressions only, except in the case of possible default arguments, where we lift also complex pure expressions, since in that case arguments can be duplicated as arguments to default argument methods.
class Object
trait Matchable
class Any
object LiftErased
object LiftToDefs
object LiftImpure
object NoLift

Value members

Abstract methods

def noLift(expr: Tree)(using Context): Boolean

Test indicating expr does not need lifting

Test indicating expr does not need lifting

Concrete methods

protected def exprLifter: Lifter

The corresponding lifter for pass-by-name arguments

The corresponding lifter for pass-by-name arguments

protected def isErased: Boolean

Is lifting performed on erased terms?

Is lifting performed on erased terms?

def liftApp(defs: ListBuffer[Tree], tree: Tree)(using Context): Tree

Lift out function prefix and all arguments from application

Lift out function prefix and all arguments from application

pre.f(arg1, ..., argN) becomes

val x0 = pre val x1 = arg1 ... val xN = argN x0.f(x1, ..., xN)

But leave pure expressions alone.

def liftArgs(defs: ListBuffer[Tree], methRef: Type, args: List[Tree])(using Context): List[Tree]

Lift arguments that are not-idempotent into ValDefs in buffer defs and replace by the idents of so created ValDefs.

Lift arguments that are not-idempotent into ValDefs in buffer defs and replace by the idents of so created ValDefs.

def liftAssigned(defs: ListBuffer[Tree], tree: Tree)(using Context): Tree

Lift out common part of lhs tree taking part in an operator assignment such as

Lift out common part of lhs tree taking part in an operator assignment such as

lhs += expr

def liftPrefix(defs: ListBuffer[Tree], tree: Tree)(using Context): Tree

Lift prefix pre of an application pre.f(...) to

Lift prefix pre of an application pre.f(...) to

val x0 = pre x0.f(...)

unless pre is idempotent.

protected def liftedDef(sym: TermSymbol, rhs: Tree)(using Context): MemberDef

The tree of a lifted definition

The tree of a lifted definition

protected def liftedFlags: FlagSet

The flags of a lifted definition

The flags of a lifted definition