Module: Jade::Frontend::ForwardDeclaration::ImplementationFunction
- Extended by:
- Codegen::Helpers, ImplementationFunction
- Included in:
- ImplementationFunction
- Defined in:
- lib/jade/frontend/forward_declaration/implementation_function.rb
Constant Summary
Constants included from Codegen::Helpers
Codegen::Helpers::NATIVE_RUBY_CLASSES
Instance Method Summary collapse
Methods included from Codegen::Helpers
data_define, dict_constraints, dict_synthetic_name, fn_constraints, fn_impl_synthetic_name, generate_many, generate_node, impl_synthetic_name, param_synthetic_name, resolve_callee_symbol, ruby_classes_for_type, to_qualified
Instance Method Details
#declare(impl_fn, entry, interface, type_name) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/jade/frontend/forward_declaration/implementation_function.rb', line 10 def declare(impl_fn, entry, interface, type_name) impl_fn => AST::ImplementationFunction(name: fn_name, fn:) case fn in AST::Lambda(params: lambda_params) synth_name = impl_synthetic_name(interface, type_name, fn_name) stub_params, stub_return = [ lambda_params .zip(0..) .to_h { |_, i| [param_synthetic_name(i), Symbol.var(param_synthetic_name(i), nil)] }, Symbol.var("r", nil), ] Symbol .function(synth_name, stub_params, stub_return) .then { [entry.define(it), Symbol.value_ref(entry.name, synth_name)] } in AST::VariableReference [ entry, Symbol.value_ref(entry.name, fn.name), ] end end |