Wraps the condition expression of each matching statement in !(...).
For example, if (x > 0) becomes if (!(x > 0)).
Usage
negate_condition(statements = c("if", "while"))
Arguments
- statements
Character vector of statement types to target.
Must be a subset of c("if", "while"). Defaults to both.
Examples
negate_condition()
#> Mutator: <condition> → !(<condition>)
#> Query: [(if_statement condition: (_) @cond) (while_statement condition: (_) @cond)]
negate_condition(statements = "if")
#> Mutator: <condition> → !(<condition>)
#> Query: (if_statement condition: (_) @cond)