Class: Emfrp::ValueConst

Inherits:
Object
  • Object
show all
Defined in:
lib/emfrp/compile/c/syntax_exp_codegen.rb

Instance Method Summary collapse

Instance Method Details

#codegen(ct, stmts) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/emfrp/compile/c/syntax_exp_codegen.rb', line 12

def codegen(ct, stmts)
  if ct.tdef(self[:typing]).enum?(ct)
    ct.tdef(self[:typing])[:tvalues].index{|t| t[:name] == self[:name]}.to_s
  else
    name = ct.constructor_name(self[:name][:desc], self[:typing])
    "#{name}(#{self[:args].map{|x| x.codegen(ct, stmts)}.join(", ")})"
  end
end