module RuboCop::NodePattern::Macros

def def_node_search(method_name, pattern_str)

yield all descendants which match.
as soon as it finds a descendant which matches. Otherwise, it will
If the method name ends with '?', the new method will return `true`

checking whether any of them match the provided pattern
Define a method which recurses over the descendants of an AST node,
def def_node_search(method_name, pattern_str)
  compiler = Compiler.new(pattern_str, 'node')
  called_from = caller(1..1).first.split(':')
  if method_name.to_s.end_with?('?')
    node_search_first(method_name, compiler, called_from)
  else
    node_search_all(method_name, compiler, called_from)
  end
end