Class: Kumi::Core::Analyzer::Passes::NASTDimensionalAnalyzerPass

Inherits:
PassBase
  • Object
show all
Defined in:
lib/kumi/core/analyzer/passes/nast_dimensional_analyzer_pass.rb

Constant Summary

Constants inherited from PassBase

PassBase::HALT

Instance Method Summary collapse

Methods inherited from PassBase

contract_declared?, #debug, #debug_enabled?, declared_optional_reads, declared_reads, declared_writes, #initialize, optional_reads, reads, 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

#run(errors) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/kumi/core/analyzer/passes/nast_dimensional_analyzer_pass.rb', line 11

def run(errors)
  nast_module  = get_state(:nast_module, required: true)
  @input_table = get_state(:input_table, required: true)
  @registry = get_state(:registry, required: true)

  @metadata_table    = {}
  @declaration_table = {}
  @cross_axes        = {}
  @outer_axes        = {}

  debug "Analyzing NAST module with #{nast_module.decls.size} declarations"

  nast_module.decls.each { |name, decl| analyze_declaration(name, decl, errors) }

  debug "Generated metadata_table with #{@metadata_table.size} entries"
  debug "Generated declaration_table with #{@declaration_table.size} entries"

  state.with(:metadata_table, @metadata_table.freeze)
       .with(:declaration_table, @declaration_table.freeze)
       .with(:cross_axes, @cross_axes.freeze)
       .with(:outer_axes, @outer_axes.freeze)
end