BetaReduce

dotty.tools.dotc.transform.BetaReduce
See theBetaReduce companion class
object BetaReduce

Attributes

Companion
class
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
BetaReduce.type

Members list

Value members

Concrete methods

def apply(tree: Tree)(using Context): Tree

Rewrite an application

Rewrite an application

((x1, ..., xn) => b)(e1, ..., en)

to

val/def x1 = e1; ...; val/def xn = en; b

where def is used for call-by-name parameters. However, we shortcut any NoPrefix refs among the ei's directly without creating an intermediate binding.

Similarly, rewrites type applications

([X1, ..., Xm] => (x1, ..., xn) => b).apply[T1, .., Tm](e1, ..., en)

to

type X1 = T1; ...; type Xm = Tm;val/def x1 = e1; ...; val/def xn = en; b

This beta-reduction preserves the integrity of Inlined tree nodes.

Attributes

def reduceApplication(ddef: DefDef, argss: List[List[Tree]], bindings: ListBuffer[DefTree])(using Context): Tree

Beta-reduces a call to ddef with arguments args and registers new bindings

Beta-reduces a call to ddef with arguments args and registers new bindings

Attributes

Concrete fields

val name: String