Class: Kumi::Core::Analyzer::Passes::InputCollector

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

Defined Under Namespace

Classes: Node

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



26
27
28
29
30
31
32
33
34
35
36
# File 'lib/kumi/core/analyzer/passes/input_collector.rb', line 26

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