Class: Evilution::Mutator::Operator::ArgumentMethodCallReplacement
- Inherits:
-
Base
- Object
- Prism::Visitor
- Base
- Evilution::Mutator::Operator::ArgumentMethodCallReplacement
- Defined in:
- lib/evilution/mutator/operator/argument_method_call_replacement.rb
Overview
Replaces a method-call argument with its receiver: ‘fn(x.attr)` -> `fn(x)`. High-signal for log payloads, structured-data construction, and API request bodies where a method call on a local variable / param appears in argument position. Covered byte-wise by `MethodCallRemoval` already; this operator surfaces the same byte change under a more specific name so the argument-substitution pattern is legible in mutation output.
Fires for:
-
positional / keyword arguments of any CallNode
-
hash values inside HashNode / KeywordHashNode (incl. inside call args)
-
array elements inside ArrayNode
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #visit_array_node(node) ⇒ Object
- #visit_call_node(node) ⇒ Object
- #visit_hash_node(node) ⇒ Object
- #visit_keyword_hash_node(node) ⇒ Object
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_array_node(node) ⇒ Object
23 24 25 26 |
# File 'lib/evilution/mutator/operator/argument_method_call_replacement.rb', line 23 def visit_array_node(node) node.elements.each { |element| try_replace(element) } super end |
#visit_call_node(node) ⇒ Object
17 18 19 20 21 |
# File 'lib/evilution/mutator/operator/argument_method_call_replacement.rb', line 17 def visit_call_node(node) node.arguments.arguments.each { |arg| try_replace(arg) } if node.arguments super end |
#visit_hash_node(node) ⇒ Object
28 29 30 31 |
# File 'lib/evilution/mutator/operator/argument_method_call_replacement.rb', line 28 def visit_hash_node(node) process_assocs(node.elements) super end |
#visit_keyword_hash_node(node) ⇒ Object
33 34 35 36 |
# File 'lib/evilution/mutator/operator/argument_method_call_replacement.rb', line 33 def visit_keyword_hash_node(node) process_assocs(node.elements) super end |