Module: RuboCop::AST::Traversal

Defined in:
lib/rubocop/ast/traversal.rb

Overview

Provides methods for traversing an AST. Does not transform an AST; for that, use Parser::AST::Processor. Override methods to perform custom processing. Remember to call ‘super` if you want to recursively process descendant nodes.

Defined Under Namespace

Classes: DebugError

Constant Summary collapse

TYPE_TO_METHOD =
Hash.new { |h, type| h[type] = :"on_#{type}" }
MISSING =
to_define

Constants included from CallbackCompiler

CallbackCompiler::SEND, CallbackCompiler::TEMPLATE

Instance Method Summary collapse

Instance Method Details

#walk(node) ⇒ Object



17
18
19
20
21
22
# File 'lib/rubocop/ast/traversal.rb', line 17

def walk(node)
  return if node.nil?

  send(TYPE_TO_METHOD[node.type], node)
  nil
end