lib/ruby2js.rb in ruby2js-4.2.0 vs lib/ruby2js.rb in ruby2js-4.2.1
- old
+ new
@@ -183,9 +183,20 @@
def on_taglit(node); on_pair(node); end
# provide a method so filters can call 'super'
def on_sym(node); node; end
+ # convert numbered parameters block to a normal block
+ def on_numblock(node)
+ call, count, block = node.children
+
+ process s(:block,
+ call,
+ s(:args, *((1..count).map {|i| s(:arg, "_#{i}")})),
+ block
+ )
+ end
+
# convert map(&:symbol) to a block
def on_send(node)
if node.children.length > 2 and node.children.last.type == :block_pass
method = node.children.last.children.first.children.last
if BINARY_OPERATORS.include? method