class Opal::Parser::BreakNode

def generate(opts, level)

def generate(opts, level)
  code = []
  if @args[0]
    @args[0].each { |arg| code << arg.generate(opts, LEVEL_EXPR) }
  end
  case code.length
  when 0
    code = "nil"
  when 1
    code = code[0]
  else
    code = '[' + code.join(', ') + ']'
  end
  if opts[:scope].in_while_scope?
    while_scope = opts[:scope].while_scope
    tmp_break_val = while_scope.set_captures_break
    "#{tmp_break_val} = #{code}; break"
  elsif opts[:scope].is_a? BlockNode
    if level == LEVEL_TOP
      "return ($B.b.$value = #{code}, $B.b)"
    else
      # block must have a try/catch wrapper inside to detect
      # breaks and return the break value if a break is fired.
      # We should also warn that the ruby code is not optimized
      # and suggest it is reconfigured to avoid the (possibly)
      # expensive try/catch block.
      "$break(#{code})"
    end
  else
    "$break(#{code})"
  end
end

def initialize(start, args)

def initialize(start, args)
  @line = start[:line]
  @args = args
end

def returns

request to return ourself if last statement
as we either throw or return ourself we can ignore the
def returns
  self
end