Class: SFRP::Poly::VConstCallExp
- Inherits:
-
Object
- Object
- SFRP::Poly::VConstCallExp
- Defined in:
- lib/sfrp/poly/expression.rb
Instance Method Summary collapse
- #called_func_strs ⇒ Object
- #clone ⇒ Object
-
#initialize(vconst_str, arg_exps, id = nil) ⇒ VConstCallExp
constructor
A new instance of VConstCallExp.
- #to_mono(monofier) ⇒ Object
- #typing(set, var_env) ⇒ Object
Constructor Details
#initialize(vconst_str, arg_exps, id = nil) ⇒ VConstCallExp
Returns a new instance of VConstCallExp.
76 77 78 79 80 |
# File 'lib/sfrp/poly/expression.rb', line 76 def initialize(vconst_str, arg_exps, id = nil) @vconst_str = vconst_str @arg_exps = arg_exps @id = id end |
Instance Method Details
#called_func_strs ⇒ Object
94 95 96 |
# File 'lib/sfrp/poly/expression.rb', line 94 def called_func_strs @arg_exps.flat_map(&:called_func_strs) end |
#clone ⇒ Object
90 91 92 |
# File 'lib/sfrp/poly/expression.rb', line 90 def clone VConstCallExp.new(@vconst_str, @arg_exps.map(&:clone), @id) end |
#to_mono(monofier) ⇒ Object
98 99 100 101 102 103 |
# File 'lib/sfrp/poly/expression.rb', line 98 def to_mono(monofier) raise UndeterminableTypeError.new(@id, @typing) unless @typing.mono? mono_vconst_str = monofier.use_vconst(@vconst_str, @typing) args = @arg_exps.map { |e| e.to_mono(monofier) } M.vc_call_e(monofier.use_type(@typing), mono_vconst_str, *args) end |
#typing(set, var_env) ⇒ Object
82 83 84 85 86 87 88 |
# File 'lib/sfrp/poly/expression.rb', line 82 def typing(set, var_env) raise if @typing @ftyping = set.vconst(@vconst_str).ftyping.instance do |ft| ft.params.zip(@arg_exps) { |t, e| e.typing(set, var_env).unify(t) } end @typing = @ftyping.body end |