class Flor::Macro::Iterator

Public Instance Methods

rewrite_iterator_tree(procedure_name) click to toggle source
# File lib/flor/pcore/iterator.rb, line 147
def rewrite_iterator_tree(procedure_name)

  atts = att_children

  l = tree[2]

  th = [ procedure_name, [], l, *tree[3] ]
  atts.each { |ac| th[1] << Flor.dup(ac) }

  if non_att_children.any?

    td = [ 'def', [], l ]

    #td[1] << [ '_att', [ [ 'res', [], l ] ], l ] \
    #  if procedure_name == 'reduce'
    #td[1] << [ '_att', [ [ 'elt', [], l ] ], l ]
      #
      # the "_apply" does that work now and it distinguishes elt vs key/val

    non_att_children.each { |nac| td[1] << Flor.dup(nac) }

    th[1] << td
  end

  th
end