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
DeclarationValidatorPass, SemanticConstraintValidatorPass, UnsatDetectorPass
Constant Summary
Constants inherited from PassBase
Instance Method Summary collapse
-
#visit(node) {|Syntax::Node| ... } ⇒ Object
Visit a node and all its children using depth-first traversal.
Methods inherited from PassBase
contract_declared?, #debug, #debug_enabled?, declared_optional_reads, declared_reads, declared_writes, #initialize, optional_reads, reads, #run, writes
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 |