The behaviour of an operator family (design notes §8.1).
A family is offered every site the walk reaches in one of its positions/0 and
returns the replacements it makes there, each with its variant label (or nil for a
family without labels). Replacements are Sourceror AST; they reuse the original
operands so that the rendered mutant stays small.
use Juggernaut.Operator, name: :relational, positions: [:runtime, :guard], variants: [...]
defines name/0, category/0 (from Juggernaut.Operators.Catalog), positions/0 and
variants/0; the module implements mutate/2.
Summary
Callbacks
The family's category.
The replacements this family makes at node, or [].
The family name, as Juggernaut.Operators.Catalog lists it.
The positions this family mutates.
The variant labels an ignore filter may name (family:label).
Types
Callbacks
@callback category() :: atom()
The family's category.
@callback mutate(node :: Macro.t(), ctx :: Juggernaut.Mutator.Context.t()) :: [ replacement() ]
The replacements this family makes at node, or [].
@callback name() :: atom()
The family name, as Juggernaut.Operators.Catalog lists it.
@callback positions() :: [position()]
The positions this family mutates.
@callback variants() :: [String.t()]
The variant labels an ignore filter may name (family:label).