Sha256: 9fb1ac788260b3e9929c4794a8a8ba8f89273222f5dc8e0fb8c0d1478eca23a6

Contents?: true

Size: 672 Bytes

Versions: 2

Compression:

Stored size: 672 Bytes

Contents

module Gisele
  module Language
    class Rewriter
      class WorkOnNodes < Helper
        include AST::Helpers

        def call(rw, node, &bl)
          node = pre_call(node)
          tran = next_call(rw, node, bl)
          post_call(tran)
        end

        protected

        def pre_call(node)
          unless looks_a_node?(node)
            msg = "AST node expected, got #{node.inspect}"
            raise ArgumentError, msg, caller
          end
          node(node)
        end

        def post_call(t)
          looks_a_node?(t) ? node(t) : t
        end

      end # module WorkOnNodes
    end # class Rewriter
  end # module Language
end # module Gisele

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gisele-0.4.0 lib/gisele/language/rewriter/work_on_nodes.rb
gisele-0.3.0 lib/gisele/language/rewriter/work_on_nodes.rb