Class: Kumi::Core::Analyzer::Passes::Codegen::RubyPass

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

Constant Summary collapse

LIR =
Kumi::Core::LIR

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



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

def run(_errors)
  decls = get_state(:lir_module)
  manifest = get_state(:binding_manifest)[:ruby]
  schema_digest = get_state(:schema_digest)
  hints = get_state(:hints)
  # The codegen pass no longer needs direct access to the registry
  emitter = Codegen::Ruby::Emitter.new(manifest["kernels"], manifest["bindings"])

  decls = decls.reject { |n, _v| hints[n][:inline] }
  src = emitter.emit(decls, schema_digest:)

  files = { "codegen.rb" => src }
  state.with(:ruby_codegen_files, files)
end