Sha256: 1ce56fbb913210226852184a0af760aad726e2a70bef5a28ae3541d1f56e35e2

Contents?: true

Size: 541 Bytes

Versions: 16

Compression:

Stored size: 541 Bytes

Contents

# frozen_string_literal: true

require 'opal/nodes/base'

module Opal
  module Nodes
    module Args
      # This node is responsible for initializing a single
      # required block arg
      #
      #   proc { |a| }
      #
      # Procs don't have arity checking and code like
      #   proc { |a| }.call
      # must return nil
      class InitializeIterarg < Base
        handle :initialize_iter_arg
        children :name

        def compile
          push "if (#{name} == null) #{name} = nil"
        end
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
opal-1.8.3.rc1 lib/opal/nodes/args/initialize_iterarg.rb
opal-1.8.2 lib/opal/nodes/args/initialize_iterarg.rb
opal-1.8.1 lib/opal/nodes/args/initialize_iterarg.rb
opal-1.8.0 lib/opal/nodes/args/initialize_iterarg.rb
opal-1.8.0.beta1 lib/opal/nodes/args/initialize_iterarg.rb
opal-1.7.4 lib/opal/nodes/args/initialize_iterarg.rb
opal-1.8.0.alpha1 lib/opal/nodes/args/initialize_iterarg.rb
opal-1.7.3 lib/opal/nodes/args/initialize_iterarg.rb
opal-1.7.2 lib/opal/nodes/args/initialize_iterarg.rb
opal-1.7.1 lib/opal/nodes/args/initialize_iterarg.rb
opal-1.7.0 lib/opal/nodes/args/initialize_iterarg.rb
opal-1.7.0.rc1 lib/opal/nodes/args/initialize_iterarg.rb
opal-1.6.1 lib/opal/nodes/args/initialize_iterarg.rb
opal-1.6.0 lib/opal/nodes/args/initialize_iterarg.rb
opal-1.6.0.rc1 lib/opal/nodes/args/initialize_iterarg.rb
opal-1.6.0.alpha1 lib/opal/nodes/args/initialize_iterarg.rb