Class: Kumi::Core::Analyzer::Passes::PassBase
- Inherits:
-
Object
- Object
- Kumi::Core::Analyzer::Passes::PassBase
- Includes:
- ErrorReporting, Syntax
- Defined in:
- lib/kumi/core/analyzer/passes/pass_base.rb
Overview
Base class for analyzer passes with simple immutable state
Direct Known Subclasses
AssembleIRV2Pass, AttachAnchorsPass, AttachTerminalInfoPass, Codegen::JsPass, Codegen::RubyPass, ConstantFoldingPass, ContractCheckerPass, DependencyResolver, IRDependencyPass, IRExecutionSchedulePass, ImportAnalysisPass, InputAccessPlannerPass, InputCollector, InputFormSchemaPass, JoinReducePlanningPass, LIR::ConstantPropagationPass, LIR::DeadCodeEliminationPass, LIR::HoistScalarReferencesPass, LIR::InlineDeclarationsPass, LIR::InstructionSchedulingPass, LIR::KernelBindingPass, LIR::LocalCSEPass, LIR::LoopFusionPass, LIR::LoopInvariantCodeMotionPass, LIR::LowerPass, LIR::ValidationPass, LoadInputCSE, LowerToIRV2Pass, NASTDimensionalAnalyzerPass, NameIndexer, NormalizeToNASTPass, OutputSchemaPass, PrecomputeAccessPathsPass, SNASTPass, Toposorter, VisitorPass
Instance Method Summary collapse
- #debug(message) ⇒ Object
-
#debug_enabled? ⇒ Boolean
Debug helpers - automatic pattern based on pass class name InputIndexTablePass -> DEBUG_INPUT_INDEX_TABLE=1 ScopeResolutionPass -> DEBUG_SCOPE_RESOLUTION=1.
-
#initialize(schema, state) ⇒ PassBase
constructor
A new instance of PassBase.
-
#run(errors) ⇒ AnalysisState
Main pass execution - subclasses implement this.
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
#initialize(schema, state) ⇒ PassBase
Returns a new instance of PassBase.
14 15 16 17 |
# File 'lib/kumi/core/analyzer/passes/pass_base.rb', line 14 def initialize(schema, state) @schema = schema @state = state end |
Instance Method Details
#debug(message) ⇒ Object
35 36 37 38 |
# File 'lib/kumi/core/analyzer/passes/pass_base.rb', line 35 def debug() class_name = self.class.name.split("::").last.gsub(/Pass$/, "") puts "[#{class_name}] #{}" if debug_enabled? end |
#debug_enabled? ⇒ Boolean
Debug helpers - automatic pattern based on pass class name InputIndexTablePass -> DEBUG_INPUT_INDEX_TABLE=1 ScopeResolutionPass -> DEBUG_SCOPE_RESOLUTION=1
29 30 31 32 33 |
# File 'lib/kumi/core/analyzer/passes/pass_base.rb', line 29 def debug_enabled? class_name = self.class.name.split("::").last env_name = "DEBUG_#{to_underscore(class_name.gsub(/Pass$/, '')).upcase}" ENV[env_name] == "1" end |
#run(errors) ⇒ AnalysisState
Main pass execution - subclasses implement this
22 23 24 |
# File 'lib/kumi/core/analyzer/passes/pass_base.rb', line 22 def run(errors) raise NotImplementedError, "#{self.class.name} must implement #run" end |