class SFRP::Poly::DSL::FuncProxy

Public Class Methods

new(func_str, ret_type_annot = nil) click to toggle source
# 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

Public Instance Methods

exp(&block) click to toggle source
# File lib/sfrp/poly/dsl.rb, line 100
def exp(&block)
  @exp = block.call
end
ffi_str(str) click to toggle source
# File lib/sfrp/poly/dsl.rb, line 96
def ffi_str(str)
  @ffi_str = str
end
param(param_str, type_annot = nil) click to toggle source
# 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() click to toggle source
# 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