InlineReducer

dotty.tools.dotc.inlines.InlineReducer
class InlineReducer(inliner: Inliner)(using x$2: Context)

A utility class offering methods for rewriting inlined code

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Type members

Types

The result type of reducing a match. It consists optionally of a list of bindings for the pattern-bound variables and the RHS of the selected case. Returns None if no case was selected.

The result type of reducing a match. It consists optionally of a list of bindings for the pattern-bound variables and the RHS of the selected case. Returns None if no case was selected.

Attributes

Same as MatchRedux, but also includes a boolean that is true if the guard can be checked at compile time.

Same as MatchRedux, but also includes a boolean that is true if the guard can be checked at compile time.

Attributes

Value members

Concrete methods

If this is a value binding:

If this is a value binding:

  • reduce its rhs if it is a projection and adjust its type accordingly,
  • record symbol -> rhs in the InlineBindings context propery.

Attributes

def reduceInlineMatch(scrutinee: Tree, scrutType: Type, cases: List[CaseDef], typer: Typer)(using Context): MatchRedux

Reduce an inline match

Reduce an inline match

Value parameters

mtch

the match tree

scrutType

its fully defined type, or ImplicitScrutineeTypeRef for a summonFrom

scrutinee

the scrutinee expression, assumed to be pure, or EmptyTree for a summonFrom

typer

The current inline typer

Attributes

Returns

optionally, if match can be reduced to a matching case: A pair of bindings for all pattern-bound variables and the RHS of the case.

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

If tree is equivalent to new C(args).x where class C does not have initialization code and x is a parameter corresponding to one of the arguments args, the corresponding argument, otherwise tree itself. Side effects of original arguments need to be preserved.

If tree is equivalent to new C(args).x where class C does not have initialization code and x is a parameter corresponding to one of the arguments args, the corresponding argument, otherwise tree itself. Side effects of original arguments need to be preserved.

Attributes