class RuboCop::AST::Node

def visit_ancestors(types)

def visit_ancestors(types)
  last_node = self
  while (current_node = last_node.parent)
    yield current_node if types.empty? ||
                          types.include?(current_node.type)
    last_node = current_node
  end
end