def ensure_loaded!(object, max_retries = 1)
return if object.root?
return object unless object.is_a?(Proxy)
unless parser.load_order_errors
if object.is_a?(Proxy)
raise NamespaceMissingError, object
else
nil
end
end
unless CONTINUATIONS_SUPPORTED
unless $NO_CONTINUATION_WARNING
$NO_CONTINUATION_WARNING = true
log.warn "JRuby/MacRuby/Rubinius do not implement Kernel#callcc and cannot " +
"load files in order. You must specify the correct order manually."
end
raise NamespaceMissingError, object
end
retries = 0
context = callcc {|c| c }
retries += 1
if object.is_a?(Proxy)
if retries <= max_retries
log.debug "Missing object #{object} in file `#{parser.file}', moving it to the back of the line."
raise Parser::LoadOrderError, context
else
raise NamespaceMissingError, object
end
end
object
end