Class: Evilution::Mutator::Operator::BooleanOperandPromotion Private

Inherits:
Base
  • Object
show all
Defined in:
lib/evilution/mutator/operator/boolean_operand_promotion.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.

Drop one side of a compound boolean: a && b becomes a and b, and the same for || (both the symbol and the and / or keyword forms).

BooleanOperatorReplacement swaps the operator but always keeps both operands, so a test that only ever exercises one side of a condition survives it. Promoting an operand kills exactly those tests.

Instance Attribute Summary

Attributes inherited from Base

#mutations

Instance Method Summary collapse

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_and_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.



12
13
14
15
# File 'lib/evilution/mutator/operator/boolean_operand_promotion.rb', line 12

def visit_and_node(node)
  promote_operands(node)
  super
end

#visit_or_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.



17
18
19
20
# File 'lib/evilution/mutator/operator/boolean_operand_promotion.rb', line 17

def visit_or_node(node)
  promote_operands(node)
  super
end