lib/rdoc/parser/prism_ruby.rb in rdoc-6.10.0 vs lib/rdoc/parser/prism_ruby.rb in rdoc-6.11.0
- old
+ new
@@ -640,17 +640,19 @@
handle_consecutive_comment_directive(@container, comment)
return unless @container.document_children
owner, name = find_or_create_constant_owner_name(module_name)
if is_class
- mod = owner.classes_hash[name] || owner.add_class(RDoc::NormalClass, name, superclass_name || '::Object')
-
# RDoc::NormalClass resolves superclass name despite of the lack of module nesting information.
# We need to fix it when RDoc::NormalClass resolved to a wrong constant name
if superclass_name
superclass_full_path = resolve_constant_path(superclass_name)
superclass = @store.find_class_or_module(superclass_full_path) if superclass_full_path
superclass_full_path ||= superclass_name
+ end
+ # add_class should be done after resolving superclass
+ mod = owner.classes_hash[name] || owner.add_class(RDoc::NormalClass, name, superclass_name || '::Object')
+ if superclass_name
if superclass
mod.superclass = superclass
elsif mod.superclass.is_a?(String) && mod.superclass != superclass_full_path
mod.superclass = superclass_full_path
end