Module: Jade::Frontend::TypeChecking::PortResolution
- Extended by:
- PortResolution
- Included in:
- PortResolution
- Defined in:
- lib/jade/frontend/type_checking/port_resolution.rb
Overview
Resolves the instances each port needs to convert at the boundary:
Decode.Decodable for its ok/err arms, Encode.Encodable for its
arguments. Runs at the end of type-checking, when
registry.implementations is fully populated. The resolved
Symbol::Implementation (or the :pass sentinel for Decode.Value / Never)
is stamped onto each InteropFunction's decoders / encoders fields
so codegen can emit straight away.
Instance Method Summary collapse
Instance Method Details
#resolve(entry, registry) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/jade/frontend/type_checking/port_resolution.rb', line 20 def resolve(entry, registry) entry .defined_values .reduce([{}, []]) do |(values, errors), (name, sym)| new_sym, new_errors = resolve_value(sym, entry, registry) [ values.merge(name => new_sym), errors + new_errors, ] end .then { |values, errors| errors.empty? \ ? Ok[entry.with(defined_values: values)] : Err[errors] } end |