Class: SFRP::Poly::TypeAnnotationType

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

Instance Method Summary collapse

Constructor Details

#initialize(tconst_str, arg_type_annots) ⇒ TypeAnnotationType

Returns a new instance of TypeAnnotationType.



159
160
161
162
# File 'lib/sfrp/poly/typing.rb', line 159

def initialize(tconst_str, arg_type_annots)
  @tconst_str = tconst_str
  @arg_type_annots = arg_type_annots
end

Instance Method Details

#to_sObject



172
173
174
175
# File 'lib/sfrp/poly/typing.rb', line 172

def to_s
  return @tconst_str if @arg_type_annots.empty?
  "#{@tconst_str}[#{@arg_type_annots.map(&:to_s).join(', ')}]"
end

#to_typing(tbl) ⇒ Object



164
165
166
# File 'lib/sfrp/poly/typing.rb', line 164

def to_typing(tbl)
  Typing.new(@tconst_str, @arg_type_annots.map { |ta| ta.to_typing(tbl) })
end

#var_strsObject



168
169
170
# File 'lib/sfrp/poly/typing.rb', line 168

def var_strs
  @arg_type_annots.flat_map(&:var_strs)
end