class MapRewriter

We want to rewrite “map” calls on BudCollections to “pro” calls. It is hard to do this precisely (issue #225), so we just replace map calls liberally and define Enumerable#pro as an alias for “map”.

Public Class Methods

new() click to toggle source
Calls superclass method
# File lib/bud/rewrite.rb, line 296
def initialize
  super
  self.require_empty = false
  self.expected = Sexp
end

Public Instance Methods

process_call(exp) click to toggle source
# File lib/bud/rewrite.rb, line 302
def process_call(exp)
  tag, recv, op, *args = exp

  if op == :map and args.empty?
    op = :pro
  end

  s(tag, process(recv), op, *(args.map{|a| process(a)}))
end