module Bundler::SafeCatch::Internal

def self.catch(tag, &block)

def self.catch(tag, &block)
  @recurse_count += 1
  if SAFE_RECURSE_EVERY >= 0 && @recurse_count % SAFE_RECURSE_EVERY == 0
    SAFE_RECURSE_CLASS.new(&block).send(SAFE_RECURSE_START)
  else
    block.call
  end
rescue Result.matcher(tag)
  $!.value
end

def self.throw(tag, value = nil)

def self.throw(tag, value = nil)
  raise Result.new(tag, value)
end