Inliner

object Inliner
Companion:
class
class Object
trait Matchable
class Any
Inliner.type

Type members

Classlikes

object Intrinsics

Very similar to TreeInfo.isPureExpr, but with the following inliner-only exceptions:

Very similar to TreeInfo.isPureExpr, but with the following inliner-only exceptions:

  • synthetic case class apply methods, when the case class constructor is empty, are elideable but not pure. Elsewhere, accessing the apply method might cause the initialization of a containing object so they are merely idempotent.

Value members

Concrete methods

def bodyRetainer(mdef: DefDef)(using Context): DefDef

For a retained inline method, another method that keeps track of the body that is kept at runtime. For instance, an inline method

For a retained inline method, another method that keeps track of the body that is kept at runtime. For instance, an inline method

inline override def f(x: T) = b

is complemented by the body retainer method

private def f$retainedBody(x: T) = f(x)

where the call f(x) is inline-expanded. This body is then transferred back to f at erasure, using method addRetainedInlineBodies.

The body to inline for method sym, or EmptyTree if none exists.

The body to inline for method sym, or EmptyTree if none exists.

def dropInlined(inlined: Inlined)(using Context): Tree

Replace Inlined node by a block that contains its bindings and expansion

Replace Inlined node by a block that contains its bindings and expansion

sym is an inline method with a known body to inline.

sym is an inline method with a known body to inline.

Are we in an inline method body?

Are we in an inline method body?

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

Try to inline a call to an inline method. Fail with error if the maximal inline depth is exceeded.

Try to inline a call to an inline method. Fail with error if the maximal inline depth is exceeded.

Value parameters:
pt

The expected type of the call.

tree

The call to inline

Returns:

An Inlined node that refers to the original call and the inlined bindings and body that replace it.

def inlineCallTrace(callSym: Symbol, pos: SourcePosition)(using Context): Tree

Leave only a call trace consisting of

Leave only a call trace consisting of

  • a reference to the top-level class from which the call was inlined,
  • the call's position in the call field of an Inlined node. The trace has enough info to completely reconstruct positions. Note: For macros it returns a Select and for other inline methods it returns an Ident (this distinction is only temporary to be able to run YCheckPositions)
def inlinedUnapply(unapp: UnApply)(using Context): Tree

Try to inline a pattern with an inline unapply method. Fail with error if the maximal inline depth is exceeded.

Try to inline a pattern with an inline unapply method. Fail with error if the maximal inline depth is exceeded.

Value parameters:
unapp

The tree of the pattern to inline

Returns:

An Unapply with a fun containing the inlined call to the unapply

def isInlineable(meth: Symbol)(using Context): Boolean

Can a call to method meth be inlined?

Can a call to method meth be inlined?

def needsInlining(tree: Tree)(using Context): Boolean

Should call be inlined in this context?

Should call be inlined in this context?

def reposition(tree: Tree, callSpan: Span)(using Context): Tree