class Ivar::MethodTargetedInstanceVariableReferenceVisitor

def visit_def_node(node)

Only visit the method definition we're targeting
def visit_def_node(node)
  # Check if this is our target method
  if node.name.to_sym == @target_method_name && node.location.start_line == @target_line
    # Found our target method, now collect all instance variable references within it
    collector = IvarCollector.new(@file_path, @target_method_name)
    node.body&.accept(collector)
    @references = collector.references
    false
  else
    # Sometimes methods are found inside other methods...
    node.body&.accept(self)
    true
  end
end