Class: CGenerator::CFile::FunctionAccumulator
- Inherits:
-
Accumulator
- Object
- Accumulator
- CGenerator::CFile::FunctionAccumulator
- Defined in:
- lib/cgen/cgen.rb
Instance Attribute Summary
Attributes inherited from Accumulator
Instance Method Summary collapse
Methods inherited from Accumulator
#accept?, #add_one, #add_one_really, #initialize, #inspect, #inspect_one, #output, #output_one, #to_s
Constructor Details
This class inherits a constructor from CGenerator::Accumulator
Instance Method Details
#add(name, kind = Function) ⇒ Object
1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 |
# File 'lib/cgen/cgen.rb', line 1407 def add name, kind = Function @parent.assert_uncommitted name = name.intern if name.is_a? String if kind.is_a? Symbol or kind.is_a? String kind = eval "CGenerator::#{kind}" end unless kind <= Function raise ArgumentError, "#{kind.class} #{kind} is not a subclass of CGenerator::Function." end fn = @pile.find { |f| f.name == name } unless fn fn = kind.new name, @parent super fn end fn end |
#separator ⇒ Object
1428 1429 1430 |
# File 'lib/cgen/cgen.rb', line 1428 def separator "\n\n" end |