lib/yard/handlers/c/handler_methods.rb in yard-0.8.7.3 vs lib/yard/handlers/c/handler_methods.rb in yard-0.8.7.4
- old
+ new
@@ -6,10 +6,15 @@
include CodeObjects
def handle_class(var_name, class_name, parent, in_module = nil)
parent = nil if parent == "0"
namespace = in_module ? namespace_for_variable(in_module) : Registry.root
+ if namespace.nil?
+ raise Parser::UndocumentableError, "class #{class_name}. " +
+ "Cannot find definition for parent namespace."
+ end
+
register ClassObject.new(namespace, class_name) do |obj|
if parent
parent_class = namespace_for_variable(parent)
if parent_class.is_a?(Proxy)
obj.superclass = "::#{parent_class.path}"
@@ -23,10 +28,15 @@
end
end
def handle_module(var_name, module_name, in_module = nil)
namespace = in_module ? namespace_for_variable(in_module) : Registry.root
+ if namespace.nil?
+ raise Parser::UndocumentableError, "module #{module_name}. " +
+ "Cannot find definition for parent namespace."
+ end
+
register ModuleObject.new(namespace, module_name) do |obj|
namespaces[var_name] = obj
register_file_info(obj, statement.file, statement.line)
end
end
@@ -43,9 +53,10 @@
namespace = namespace_for_variable(var_name)
return if namespace.nil? # XXX: raise UndocumentableError might be too noisy.
register MethodObject.new(namespace, name, scope) do |obj|
register_visibility(obj, visibility)
find_method_body(obj, func_name)
+ obj.explicit = true
obj.add_tag(Tags::Tag.new(:return, '', 'Boolean')) if name =~ /\?$/
end
end
def handle_attribute(var_name, name, read, write)