Module: Jade::Frontend::SemanticAnalysis::InteropImportDeclaration

Extended by:
Helper, InteropImportDeclaration
Included in:
InteropImportDeclaration
Defined in:
lib/jade/frontend/semantic_analysis/interop_import_declaration.rb

Instance Method Summary collapse

Methods included from Helper

analyze_duplicate_fields, analyze_in_parallel, analyze_in_sequence, analyze_node, bind, collect_vars, lookup, validate_type_symbol

Instance Method Details

#analyze(node, registry, scope, entry) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/jade/frontend/semantic_analysis/interop_import_declaration.rb', line 8

def analyze(node, registry, scope, entry)
  node => AST::InteropImportDeclaration(functions:)

  functions_with_symbols = functions.map do |fn|
    entry
      .lookup_value(fn.name)
      .then { fn.with(symbol: it) }
  end

  type_errors = functions_with_symbols
    .flat_map { validate_type_symbol(it.symbol, registry, entry) }

  task_errors = functions_with_symbols
    .flat_map { |fn| task_shape_errors(fn, entry) }

  Result
    .init(node.with(functions: functions_with_symbols), scope)
    .add_errors(type_errors + task_errors)
end