Class: SFRP::Poly::DSL::FuncProxy
- Inherits:
-
Object
- Object
- SFRP::Poly::DSL::FuncProxy
- Defined in:
- lib/sfrp/poly/dsl.rb
Instance Method Summary collapse
- #exp(&block) ⇒ Object
- #ffi_str(str) ⇒ Object
-
#initialize(func_str, ret_type_annot = nil) ⇒ FuncProxy
constructor
A new instance of FuncProxy.
- #param(param_str, type_annot = nil) ⇒ Object
- #to_func ⇒ Object
Constructor Details
#initialize(func_str, ret_type_annot = nil) ⇒ FuncProxy
Returns a new instance of FuncProxy.
84 85 86 87 88 89 |
# File 'lib/sfrp/poly/dsl.rb', line 84 def initialize(func_str, ret_type_annot = nil) @func_str = func_str @ret_type_annot = ret_type_annot || DSL.tv('%a0') @param_strs = [] @type_annots = [] end |
Instance Method Details
#exp(&block) ⇒ Object
100 101 102 |
# File 'lib/sfrp/poly/dsl.rb', line 100 def exp(&block) @exp = block.call end |
#ffi_str(str) ⇒ Object
96 97 98 |
# File 'lib/sfrp/poly/dsl.rb', line 96 def ffi_str(str) @ffi_str = str end |
#param(param_str, type_annot = nil) ⇒ Object
91 92 93 94 |
# File 'lib/sfrp/poly/dsl.rb', line 91 def param(param_str, type_annot = nil) @param_strs << param_str @type_annots << (type_annot || DSL.tv('%a' + @param_strs.size.to_s)) end |
#to_func ⇒ Object
104 105 106 107 |
# File 'lib/sfrp/poly/dsl.rb', line 104 def to_func ftype_annot = FuncTypeAnnotation.new(@ret_type_annot, @type_annots) Function.new(@func_str, @param_strs, ftype_annot, @exp, @ffi_str) end |