module RuboCop::AST::Traversal::CallbackCompiler

def def_callback(type, *signature,

def def_callback(type, *signature,
                 arity: signature.size..signature.size,
                 arity_check: ENV.fetch('RUBOCOP_DEBUG', nil) && self.arity_check(arity),
                 body: self.body(signature, arity_check))
  type, *aliases = type
  lineno = caller_locations(1, 1).first.lineno
  module_eval(<<~RUBY, __FILE__, lineno) # rubocop:disable Style/EvalWithLocation
    def on_#{type}(node)        # def on_send(node)
      #{body}                   #   # body ...
      nil                       #   nil
    end                         # end
  RUBY
  aliases.each do |m|
    alias_method "on_#{m}", "on_#{type}"
  end
end