
Remove negation from the condition of if/while statements
remove_condition_negation.RdThe inverse of negate_condition(). Strips the leading ! from any
already-negated condition, so if (!done) becomes if (done) and
while (!ready) becomes while (ready).
Usage
remove_condition_negation(statements = c("if", "while"))Value
A Mutator object.
Details
Unlike remove_negation(), this mutator is scoped exclusively to
conditions, leaving negations in other positions (assignments, return
values, etc.) untouched.
Examples
remove_condition_negation()
#> Mutator: !<condition> → <condition>
#> Query: [(if_statement condition: (_) @target) (while_statement condition: (_) @target)]
remove_condition_negation(statements = "while")
#> Mutator: !<condition> → <condition>
#> Query: (while_statement condition: (_) @target)