Class: Kumi::Core::Analyzer::Passes::LowerToDFIRPass

Inherits:
PassBase
  • Object
show all
Defined in:
lib/kumi/core/analyzer/passes/lower_to_dfir_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



10
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/lower_to_dfir_pass.rb', line 10

def run(_errors)
  snast_module = get_state(:snast_module, required: true)
  registry = get_state(:registry, required: true)
  input_table = get_state(:input_table, required: true)
  imported_schemas = get_state(:imported_schemas, required: false) || {}

  lowered = Kumi::IR::DF::Lower.new(
    snast_module:,
    registry:,
    input_table:
  ).call

  context = {
    registry:,
    input_table:,
    imported_schemas:,
    input_plans: get_state(:precomputed_plan_by_fqn, required: false) || {}
  }
  optimized = Kumi::IR::DF::Pipeline.run(graph: lowered, context:)

  state.with(:df_module_unoptimized, lowered.freeze)
       .with(:df_module, optimized.freeze)
end