class SFRP::Flat::Function

Public Instance Methods

to_poly(_src_set, dest_set) click to toggle source
# File lib/sfrp/flat/elements.rb, line 4
def to_poly(_src_set, dest_set)
  pstrs.reject(&:nil?).each do |s|
    raise DuplicatedVariableError.new(s) if pstrs.count(s) > 1
  end
  dest_set << P.func(str, ret_ta && ret_ta.to_poly) do |f|
    pstrs.zip(ptas) do |s, ta|
      f.param(s, ta && ta.to_poly)
    end
    if exp
      f.exp do
        table = Hash[pstrs.map { |s| [s, s] }]
        exp.alpha_convert(table, (0..1000).to_a).to_poly
      end
    end
    f.ffi_str(ffi_str) if ffi_str
  end
end