Sha256: d1e088b8124c78da032d7a7827f9e1668fa505666a9999a9ca8901aa3eff083f

Contents?: true

Size: 546 Bytes

Versions: 13

Compression:

Stored size: 546 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)
        options[:description] ||= options.delete(:description) || try(:description)
        ATP::AST::Node.new(type, children, options)
      end

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

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
atp-0.8.0 lib/atp/ast/factories.rb
atp-0.7.0 lib/atp/ast/factories.rb
atp-0.6.0 lib/atp/ast/factories.rb
atp-0.5.4 lib/atp/ast/factories.rb
atp-0.5.3 lib/atp/ast/factories.rb
atp-0.5.0 lib/atp/ast/factories.rb
atp-0.4.3 lib/atp/ast/factories.rb
atp-0.4.2 lib/atp/ast/factories.rb
atp-0.4.1 lib/atp/ast/factories.rb
atp-0.4.0 lib/atp/ast/factories.rb
atp-0.3.3 lib/atp/ast/factories.rb
atp-0.3.2 lib/atp/ast/factories.rb
atp-0.3.1 lib/atp/ast/factories.rb