The macro context (of type C
), must be provided by the inheritor
The macro context (of type C
), must be provided by the inheritor
The function prototype; specifically, the single function parameter's definition as a ValDef
.
The function prototype; specifically, the single function parameter's definition as a ValDef
. Must be
provided by the inheritor.
Matches an AST pattern against a tree recursively.
Matches an AST pattern against a tree recursively. Patterns are encoded as a partial function from scala.reflect.api.Universe.Tree to a result object; this method returns the result of applying the partial function to all AST subtrees matching it.
The return type as defined by the extraction clause of the search pattern.
The AST tree to search.
The search pattern.
scala.None if no match was found, or a scala.Some containing the result of applying the partial function to the first matching subtree.
Matches an AST pattern against a tree recursively.
Matches an AST pattern against a tree recursively. Patterns are encoded as a partial function from scala.reflect.api.Universe.Tree to a result object; this method returns the result of applying the partial function to the first AST subtree matching it.
The return type as defined by the extraction clause of the search pattern.
The AST tree to search.
The search pattern.
scala.None if no match was found, or a scala.Some containing the result of applying the partial function to the first matching subtree.
Renders a description tree for the specified AST.
Renders a description tree for the specified AST.
The AST representing the function body part for which a description is to be rendered.
The description, represented as a string literal.
Transforms an AST based on the specified pattern.
Transforms an AST based on the specified pattern. The transformation is specified as a partial function from scala.reflect.api.Universe.Tree to a another tree, where every subtree for which the function is defined is replaced with the result of its application.
The AST tree to search.
The search-and-replace pattern.
The transformed tree.
A macro helper trait that generates implicit description for expressions. The transformation operates in the context of a function of the form
Function1[ T, U ]
, or in other words only supports single-parameter functions.The expression is transformable via com.wix.accord.transform.ExpressionDescriber.renderDescriptionTree based on the following rules:
{ p: Person => p.firstName }
gets rewritten to a tree representing the string literal"firstName"
{ p: Person => p.firstName as "first name" }
gets rewritten simply as"first name"
{ _ => 1 + 2 + 3 }
gets rewritten as"1 + 2 + 3"
.The macro context type