Class: Evilution::Mutator::Operator::BooleanExpressionToNil Private

Inherits:
Base
  • Object
show all
Defined in:
lib/evilution/mutator/operator/boolean_expression_to_nil.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 a whole compound boolean with nil: a && b becomes nil, and the same for || and the and / or keyword forms.

Where BooleanOperandPromotion drops one side, this drops both. The survivor it targets is a condition whose value is never asserted — code that runs the expression for its side effects, or a test that only checks the branch was taken rather than what the branch was given.

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.



13
14
15
16
# File 'lib/evilution/mutator/operator/boolean_expression_to_nil.rb', line 13

def visit_and_node(node)
  mutate_to_nil(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.



18
19
20
21
# File 'lib/evilution/mutator/operator/boolean_expression_to_nil.rb', line 18

def visit_or_node(node)
  mutate_to_nil(node)
  super
end