Class: Kumi::Core::Analyzer::Passes::VisitorPass
- Defined in:
- lib/kumi/core/analyzer/passes/visitor_pass.rb
Overview
Base class for analyzer passes that need to traverse the AST using the visitor pattern. Inherits the new immutable state interface from PassBase.
Direct Known Subclasses
DeclarationValidator, SemanticConstraintValidator, UnsatDetector
Instance Method Summary collapse
-
#visit(node) {|Syntax::Node| ... } ⇒ Object
Visit a node and all its children using depth-first traversal.
Methods inherited from PassBase
#debug, #debug_enabled?, #initialize, #run
Methods included from ErrorReporting
#inferred_location, #raise_localized_error, #raise_syntax_error, #raise_type_error, #report_enhanced_error, #report_error, #report_semantic_error, #report_syntax_error, #report_type_error
Constructor Details
This class inherits a constructor from Kumi::Core::Analyzer::Passes::PassBase
Instance Method Details
#visit(node) {|Syntax::Node| ... } ⇒ Object
Visit a node and all its children using depth-first traversal
13 14 15 16 17 18 |
# File 'lib/kumi/core/analyzer/passes/visitor_pass.rb', line 13 def visit(node, &block) return unless node yield(node) node.children.each { |child| visit(child, &block) } end |