
Mutator
Mutator.RdMutator
Mutator
Details
Represents a single code mutation — a pattern to find and a replacement to
apply. Every mutator function (operator(), boolean_literal(), etc.)
returns an instance of this class.
Public fields
fromThe token or operator to replace.
toThe replacement token or operator.
queryTree-sitter query used to locate candidate nodes.
match_fnOptional
function(node_text)returninglogical; overrides the defaultnode_text == fromequality check.replacement_fnOptional
function(node_text)returning a string; overrides the statictovalue as the replacement text.mutate_fnOptional
function(code)that fully replaces the default mutation logic when set.
Methods
Method new()
Create a new Mutator.
Usage
Mutator$new(
from,
to,
query,
match_fn = NULL,
replacement_fn = NULL,
mutate_fn = NULL
)