class Opal::RubyParser::ReturnNode
def generate(opts, level)
def generate(opts, level) args = @args if args[0].nil? code = NilNode.new.generate opts, level elsif args[0].length == 1 code = args[0][0].generate opts, level else # this really should return array of return vals code = NilNode.new.generate opts, level end # if we are in a block, we need to throw return to nearest mthod if !opts[:scope].is_a?(DefNode) return_func = '__return_func' return "$return(#{code}, #{return_func})" # level top, we are running full stmts, so just return normally elsif level == LEVEL_TOP return "return #{code}" else "$return(#{code})" end end
def initialize(ret, val)
def initialize(ret, val) @line = ret[:line] @args = val end
def returns
def returns self end