Class: Oxc::Visitor
- Inherits:
-
Object
- Object
- Oxc::Visitor
- Defined in:
- lib/oxc/visitor.rb,
sig/oxc/visitor.rbs
Direct Known Subclasses
Instance Method Summary collapse
-
#visit(node) ⇒ void
: (Oxc::Node | Oxc::ParseResult) -> void.
-
#visit_children(node) ⇒ void
: (Oxc::Node) -> void.
Instance Method Details
#visit(node) ⇒ void
This method returns an undefined value.
: (Oxc::Node | Oxc::ParseResult) -> void
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/oxc/visitor.rb', line 6 def visit(node) node = node.root if node.is_a?(ParseResult) return nil unless node answer = "visit_#{node.underscored_type}" respond_to?(answer) ? public_send(answer, node) : visit_children(node) nil end |
#visit_children(node) ⇒ void
This method returns an undefined value.
: (Oxc::Node) -> void
19 20 21 22 23 |
# File 'lib/oxc/visitor.rb', line 19 def visit_children(node) node.child_nodes.each { |child| visit(child) } nil end |