Class: Evilution::Equivalent::Heuristic::DeadCode Private
- Inherits:
-
Object
- Object
- Evilution::Equivalent::Heuristic::DeadCode
- Defined in:
- lib/evilution/equivalent/heuristic/dead_code.rb
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.
Constant Summary collapse
- STATEMENT_DELETION_OPERATORS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Both operators produce statement-deletion-shaped edits. MutationPlanner dedupes by (file_path, mutated_source); whichever operator is registered first surfaces its name on the surviving mutation. Classify equivalence by edit shape, not by operator label, so dead-code classification holds regardless of registry order (EV-74e3 PR #1236 review).
%w[statement_deletion last_expression_removal].to_set.freeze
Instance Method Summary collapse
- #match?(mutation) ⇒ Boolean private
Instance Method Details
#match?(mutation) ⇒ Boolean
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 17 18 19 20 21 22 23 24 25 |
# File 'lib/evilution/equivalent/heuristic/dead_code.rb', line 13 def match?(mutation) return false unless STATEMENT_DELETION_OPERATORS.include?(mutation.operator_name) node = mutation.subject.node return false unless node body = node.body return false unless body.is_a?(Prism::StatementsNode) statements = body.body unreachable_lines = find_unreachable_lines(statements) unreachable_lines.include?(mutation.line) end |