reducer
A utility object offering methods for rewriting inlined code
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.
Value members
Concrete methods
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.
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.
Reduce an inline match
Reduce an inline match
- Value Params
- 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
- 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.
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.