Inlines

dotty.tools.dotc.inlines.Inlines
object Inlines

Support for querying inlineable methods and for inlining calls to such methods

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Inlines.type

Members list

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.

Attributes

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

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

Attributes

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

Attributes

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

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

Attributes

Are we in an inline method body?

Are we in an inline method body?

Attributes

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

Attributes

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)

Attributes

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

Attributes

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?

Attributes

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

Should call be inlined in this context?

Should call be inlined in this context?

Attributes

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