Skip to contents

It changes a binary operator to another one.

Usage

operator(from, to)

Arguments

from

The operator to be replaced.

to

The operator to replace with.

Examples

operator("==", "!=")
#> Mutator: == -> !=
#> Query: (binary_operator
#>       lhs: (_) @lhs
#>       operator: _ @operator
#>       rhs: (_) @rhs
#>       (#eq? @operator "==")
#>     )
operator(">", "<")
#> Mutator: > -> <
#> Query: (binary_operator
#>       lhs: (_) @lhs
#>       operator: _ @operator
#>       rhs: (_) @rhs
#>       (#eq? @operator ">")
#>     )
operator("<", ">")
#> Mutator: < -> >
#> Query: (binary_operator
#>       lhs: (_) @lhs
#>       operator: _ @operator
#>       rhs: (_) @rhs
#>       (#eq? @operator "<")
#>     )
operator("+", "-")
#> Mutator: + -> -
#> Query: (binary_operator
#>       lhs: (_) @lhs
#>       operator: _ @operator
#>       rhs: (_) @rhs
#>       (#eq? @operator "+")
#>     )