Sha256: 8bd6274fc6262f6f1831873598b1a8a6db60eccc3962a59948f7c3477bd2d019

Contents?: true

Size: 1.01 KB

Versions: 5

Compression:

Stored size: 1.01 KB

Contents

module ATP
  module Processors
    # Implements continue on a fail branch for V93K by removing any bin nodes that are
    # siblings of continue nodes. The continue nodes are also removed in the process since
    # they have now served their function.
    class ContinueImplementer < ATP::Processor
      # Delete any on-fail child if it's 'empty'
      def on_on_fail(node)
        if cont = node.find(:continue) || @continue
          node = node.updated(nil, node.children - [cont] - node.find_all(:set_result))
        end
        node.updated(nil, process_all(node.children))
      end

      def on_group(node)
        f = node.find(:on_fail)
        if f && f.find(:continue)
          with_continue do
            node = node.updated(nil, process_all(node.children))
          end
          node
        else
          node.updated(nil, process_all(node.children))
        end
      end

      def with_continue
        orig = @continue
        @continue = true
        yield
        @continue = orig
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
atp-1.1.3 lib/atp/processors/continue_implementer.rb
atp-1.1.2 lib/atp/processors/continue_implementer.rb
atp-1.1.1 lib/atp/processors/continue_implementer.rb
atp-1.1.0 lib/atp/processors/continue_implementer.rb
atp-1.0.0 lib/atp/processors/continue_implementer.rb