Class: Evilution::Mutator::Operator::IfBranchSwap Private
- Defined in:
- lib/evilution/mutator/operator/if_branch_swap.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Replace the if-branch with the else body and drop the else:
if c; x; else; y; end becomes if c; y; end.
The condition still runs and still selects, but both of its outcomes change: truthy now yields the else body, falsy now yields nil. That is out of reach of the existing conditional operators — ConditionalNegation pins the predicate to one branch, ConditionalBranch blanks a body to nil — so this survives only when the suite never distinguishes the two branch values from each other.
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #visit_if_node(node) ⇒ Object private
Methods inherited from Base
#call, clear_parse_cache!, #initialize, operator_name, parsed_tree_for
Constructor Details
This class inherits a constructor from Evilution::Mutator::Base
Instance Method Details
#visit_if_node(node) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
15 16 17 18 |
# File 'lib/evilution/mutator/operator/if_branch_swap.rb', line 15 def visit_if_node(node) swap_branches(node) super end |