class Opal::Nodes::IterNode

def compile

def compile
  is_lambda! if scope.lambda_definition?
  compile_body_or_shortcut
  blockopts = {}
  blockopts["$$arity"] = arity if arity < 0
  blockopts["$$s"] = scope.self if @define_self
  blockopts["$$brk"] = @closure.throwers[:break] if @closure&.throwers&.key? :break
  blockopts["$$ret"] = @closure.throwers[:return] if @closure&.throwers&.key? :return
  if compiler.arity_check?
    blockopts["$$parameters"] = parameters_code
  end
  if compiler.enable_source_location?
    blockopts["$$source_location"] = source_location
  end
  # MRI expands a passed argument if the block:
  # 1. takes a single argument that is an array
  # 2. has more that one argument
  # With a few exceptions:
  # 1. mlhs arg: if a block takes |(a, b)| argument
  # 2. trailing ',' in the arg list (|a, |)
  # This flag on the method indicates that a block has a top level mlhs argument
  # which means that we have to expand passed array explicitly in runtime.
  if has_top_level_mlhs_arg?
    blockopts["$$has_top_level_mlhs_arg"] = "true"
  end
  if has_trailing_comma_in_args?
    blockopts["$$has_trailing_comma_in_args"] = "true"
  end
  if blockopts.keys == ["$$arity"]
    push ", #{arity}"
  elsif !blockopts.empty?
    push ', {', blockopts.map { |k, v| "#{k}: #{v}" }.join(', '), '}'
  end
  scope.nesting if @define_nesting
  scope.relative_access if @define_relative_access
end