Sha256: 25e9fbc0922b82043ac3aad1c9c2e940d51856f063d7f2cb183de44017c8b10a

Contents?: true

Size: 462 Bytes

Versions: 2

Compression:

Stored size: 462 Bytes

Contents

module ATP
  module AST
    module Factories
      def n(type, *children)
        options = children.last.is_a?(Hash) ? children.pop : {}
        options[:file] ||= options.delete(:source_file) || try(:source_file)
        options[:line_number] ||= options.delete(:source_line_number) || try(:source_line_number)
        ATP::AST::Node.new(type, children, options)
      end

      def n0(type, options = {})
        n(type, options)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
atp-0.3.0 lib/atp/ast/factories.rb
atp-0.2.1 lib/atp/ast/factories.rb