Class: Kumi::Core::Analyzer::Passes::LowerToIRV2Pass

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

Instance Method Summary collapse

Methods inherited from PassBase

#debug, #debug_enabled?, #initialize

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

In: state, state, state Out: state



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/kumi/core/analyzer/passes/lower_to_irv2_pass.rb', line 12

def run(errors)
  snast = get_state(:snast_module, required: true)
  order = get_state(:evaluation_order, required: true)
  @input_table = get_state(:input_table, required: true)

  builder = Kumi::Core::IRV2::Builder.new
  declarations = {}

  order.each do |decl_name|
    declarations[decl_name] = lower_one_declaration(decl_name, snast, @input_table, builder, errors)
  end

  irv2_module = IRV2::Module.new(declarations, {})
  state.with(:irv2_module, irv2_module)
end