Class: Kumi::Core::Analyzer::Passes::AssembleIRV2Pass

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

Overview

Assembles the final IRv2 JSON structure from analyzer state

Input: state, state Output: state (complete JSON structure ready for serialization)

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



12
13
14
15
16
17
18
19
20
# File 'lib/kumi/core/analyzer/passes/assemble_irv2_pass.rb', line 12

def run(errors)
  irv2_module = get_state(:irv2_module, required: true)
  input_plans = get_state(:ir_input_plans, required: true)

  irv2_structure = build_irv2_structure(irv2_module, input_plans, errors)
  debug "Assembled IRv2 structure with #{irv2_structure['declarations'].size} declarations"

  state.with(:irv2, irv2_structure.freeze)
end