module Opal::Nodes::Closure::NodeSupport
def compile_catcher
def compile_catcher catchers = @closure.catchers return if catchers.empty? helper :thrower catchers_without_eval_return = catchers.grep_v(:eval_return) push "} catch($e) {" indent do catchers.each do |type| case type when :eval_return line "if ($e === Opal.t_eval_return) return $e.$v;" else line "if ($e === $t_#{type}) return $e.$v;" end end line "throw $e;" end line "}" unless catchers_without_eval_return.empty? push " finally {", *catchers_without_eval_return.map { |type| "$t_#{type}.is_orphan = true;" }, "}" end unshift "return " if closure_is? SEND unless catchers_without_eval_return.empty? unshift "var ", catchers_without_eval_return.map { |type| "$t_#{type} = $thrower('#{type}')" }.join(", "), "; " end unshift "try { " unless closure_is? JS_FUNCTION if scope.await_encountered wrap "(await (async function(){", "})())" else wrap "(function(){", "})()" end end end