Class: Kumi::Core::Analyzer::Passes::InputCollectorPass

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

Defined Under Namespace

Classes: Node

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



28
29
30
31
32
33
34
35
36
37
38
# File 'lib/kumi/core/analyzer/passes/input_collector_pass.rb', line 28

def run(errors)
  meta = {}
  schema.inputs.each { |decl| meta[decl.name] = build_node(decl) }

  # validate shape first (nice error messages with full path)
  validate_arity!(meta, errors, path: [])

  # then annotate navigation info
  annotate_children!(meta, errors)
  state.with(:input_metadata, meta.freeze)
end