Class: SFRP::Poly::VConst
- Inherits:
-
Object
- Object
- SFRP::Poly::VConst
- Defined in:
- lib/sfrp/poly/elements.rb
Instance Attribute Summary collapse
-
#str ⇒ Object
readonly
Returns the value of attribute str.
Instance Method Summary collapse
- #clone ⇒ Object
- #ftyping ⇒ Object
-
#initialize(str, annot_vars, ftype_annot, native_str = nil) ⇒ VConst
constructor
A new instance of VConst.
- #to_mono(monofier) ⇒ Object
Constructor Details
#initialize(str, annot_vars, ftype_annot, native_str = nil) ⇒ VConst
Returns a new instance of VConst.
144 145 146 147 148 149 |
# File 'lib/sfrp/poly/elements.rb', line 144 def initialize(str, annot_vars, ftype_annot, native_str = nil) @str = str @annot_vars = annot_vars @ftype_annot = ftype_annot @native_str = native_str end |
Instance Attribute Details
#str ⇒ Object (readonly)
Returns the value of attribute str.
142 143 144 |
# File 'lib/sfrp/poly/elements.rb', line 142 def str @str end |
Instance Method Details
#clone ⇒ Object
155 156 157 |
# File 'lib/sfrp/poly/elements.rb', line 155 def clone VConst.new(@str, @annot_vars, @ftype_annot, @native_str) end |
#ftyping ⇒ Object
151 152 153 |
# File 'lib/sfrp/poly/elements.rb', line 151 def ftyping @ftyping ||= @ftype_annot.to_ftyping(@annot_vars) end |
#to_mono(monofier) ⇒ Object
159 160 161 162 163 164 165 |
# File 'lib/sfrp/poly/elements.rb', line 159 def to_mono(monofier) raise UndeterminableTypeError.new(@str, @ftyping) unless @ftyping.mono? type_str = monofier.use_type(@ftyping.body) vconst_str = monofier.use_vconst(@str, @ftyping.body) arg_type_strs = @ftyping.params.map { |t| monofier.use_type(t) } M.vconst(type_str, vconst_str, arg_type_strs, @native_str) end |