Module: Jade::Frontend::TypeChecking::Inference::VariableReference

Extended by:
Helpers, VariableReference
Included in:
VariableReference
Defined in:
lib/jade/frontend/type_checking/inference/variable_reference.rb

Instance Method Summary collapse

Methods included from Helpers

check, generalize, instantiate, type_from_symbol, unify

Instance Method Details

#infer(node, registry, state, _) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/jade/frontend/type_checking/inference/variable_reference.rb', line 9

def infer(node, registry, state, _)
  node => AST::VariableReference(symbol:)

  case symbol
  in Symbol::Variable
    symbol.name
  else
    symbol.qualified_name
  end
    .then { state.env.lookup(it) }
    .then { it.attach_origin(node) }
    .then { [state, it] }
end