Class: SFRP::Poly::TConst

Inherits:
Object
  • Object
show all
Defined in:
lib/sfrp/poly/elements.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(str, paramc, vconst_strs = nil, static = false, native_str = nil) ⇒ TConst

Returns a new instance of TConst.



114
115
116
117
118
119
120
121
122
# File 'lib/sfrp/poly/elements.rb', line 114

def initialize(
  str, paramc, vconst_strs = nil, static = false, native_str = nil
)
  @str = str
  @paramc = paramc
  @vconst_strs = vconst_strs
  @static = static
  @native_str = native_str
end

Instance Attribute Details

#strObject (readonly)

Returns the value of attribute str.



112
113
114
# File 'lib/sfrp/poly/elements.rb', line 112

def str
  @str
end

Instance Method Details

#cloneObject



128
129
130
# File 'lib/sfrp/poly/elements.rb', line 128

def clone
  TConst.new(@str, @paramc, @vconst_strs, @static, @native_str)
end

#to_mono(monofier) ⇒ Object



132
133
134
135
136
137
138
# File 'lib/sfrp/poly/elements.rb', line 132

def to_mono(monofier)
  raise UndeterminableTypeError.new(@str, @typing) unless @typing.mono?
  type_str = monofier.use_type(@typing)
  return M.type(type_str, nil, @static, @native_str) unless @vconst_strs
  vconst_strs = @vconst_strs.map { |s| monofier.use_vconst(s, @typing) }
  M.type(type_str, vconst_strs, @static, @native_str)
end

#typingObject



124
125
126
# File 'lib/sfrp/poly/elements.rb', line 124

def typing
  @typing ||= Typing.new(@str, Array.new(@paramc) { Typing.new })
end