Class: SFRP::Poly::DSL::TConstProxy

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

Instance Method Summary collapse

Constructor Details

#initialize(tconst_str, var_strs, infinite) ⇒ TConstProxy

Returns a new instance of TConstProxy.



64
65
66
67
68
69
70
# File 'lib/sfrp/poly/dsl.rb', line 64

def initialize(tconst_str, var_strs, infinite)
  args = var_strs.map { |v| TypeAnnotationVar.new(v) }
  @ret_type_annot = TypeAnnotationType.new(tconst_str, args)
  @var_strs = var_strs
  @infinite = infinite
  @vconst_strs = []
end

Instance Method Details

#vconst(vconst_str, arg_type_annots, native_str = nil) ⇒ Object



72
73
74
75
76
# File 'lib/sfrp/poly/dsl.rb', line 72

def vconst(vconst_str, arg_type_annots, native_str = nil)
  ftype_annot = FuncTypeAnnotation.new(@ret_type_annot, arg_type_annots)
  @vconst_strs << vconst_str
  VConst.new(vconst_str, @var_strs, ftype_annot, native_str)
end

#vconst_strsObject



78
79
80
# File 'lib/sfrp/poly/dsl.rb', line 78

def vconst_strs
  @infinite ? nil : @vconst_strs
end