Class: CGenerator::Function::InitAccumulator

Inherits:
BlockAccumulator
  • Object
show all
Defined in:
lib/cgen/cgen.rb

Instance Method Summary collapse

Instance Method Details

#add_one_really(*args) ⇒ Object



1737
1738
1739
1740
# File 'lib/cgen/cgen.rb', line 1737

def add_one_really(*args)
  super
  @parent.declare :first_time => "static int first_time = 1"
end

#to_sObject



1742
1743
1744
1745
1746
1747
1748
1749
# File 'lib/cgen/cgen.rb', line 1742

def to_s
  if @pile.size > 0
    ["\nif (first_time)", super].join(" ") +
     "\nif (first_time) first_time = 0;\n"
  else
    ""
  end
end