Class: Evilution::Equivalent::Heuristic::DeadCode

Inherits:
Object
  • Object
show all
Defined in:
lib/evilution/equivalent/heuristic/dead_code.rb

Instance Method Summary collapse

Instance Method Details

#match?(mutation) ⇒ Boolean

Returns:

  • (Boolean)


6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/evilution/equivalent/heuristic/dead_code.rb', line 6

def match?(mutation)
  return false unless mutation.operator_name == "statement_deletion"

  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