Sha256: f75a33f2be591d99b79b1c5c748746c84240a7c921b0d183b71d1467067fbca2
Contents?: true
Size: 585 Bytes
Versions: 33
Compression:
Stored size: 585 Bytes
Contents
# frozen_string_literal: true require 'opal/rewriters/base' module Opal module Rewriters # This rewriter transforms the Ruby 2.7 numblocks to regular blocks: # # proc { _1 } # v # proc { |_1| _1 } class Numblocks < Base def on_numblock(node) left, arg_count, right = node.children s( :block, left, s(:args, *gen_args(arg_count)), right ) end def gen_args(arg_count) (1..arg_count).map do |i| s(:arg, :"_#{i}") end end end end end
Version data entries
33 entries across 33 versions & 1 rubygems