class Opal::Nodes::ResBodyNode
def compile
def compile push "if (" rescue_classes.each_with_index do |cls, idx| push ', ' unless idx == 0 call = s(:call, cls, :===, s(:arglist, s(:js_tmp, '$err'))) push expr(call) end # if no classes are given, then catch all errors push "true" if rescue_classes.empty? push ") {" if variable = rescue_variable variable[2] = s(:js_tmp, '$err') push expr(variable), ';' end line process(rescue_body, @level) line "}" end
def rescue_body
def rescue_body body || s(:nil) end
def rescue_classes
def rescue_classes classes = args.children classes.pop if classes.last and classes.last.type != :const classes end
def rescue_variable
def rescue_variable variable = args.last if Sexp === variable and [:lasgn, :iasgn].include?(variable.type) variable.dup end end