summaryrefslogtreecommitdiff
path: root/lib/rdoc/context.rb
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-03-26 05:56:26 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-03-26 05:56:26 +0000
commit98c7058bf7b3eab91c62a77cb10b09f6c8ed368e (patch)
treea90e594c950a1e3160a69f90a9e6215242937ef7 /lib/rdoc/context.rb
parentee83dc3fe49ac23321a055a2a4b337499d2494eb (diff)
Merge RDoc 6.0.3 from upstream.
It fixed the several bugs that was found after RDoc 6 releasing. From: SHIBATA Hiroshi <hsbt@ruby-lang.org> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62924 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rdoc/context.rb')
-rw-r--r--lib/rdoc/context.rb51
1 files changed, 37 insertions, 14 deletions
diff --git a/lib/rdoc/context.rb b/lib/rdoc/context.rb
index 58b1c54269..6caf0d6712 100644
--- a/lib/rdoc/context.rb
+++ b/lib/rdoc/context.rb
@@ -407,6 +407,7 @@ class RDoc::Context < RDoc::CodeObject
mod.section = current_section # TODO declaring context? something is
# wrong here...
mod.parent = self
+ mod.full_name = nil
mod.store = @store
unless @done_documenting then
@@ -414,6 +415,10 @@ class RDoc::Context < RDoc::CodeObject
# this must be done AFTER adding mod to its parent, so that the full
# name is correct:
all_hash[mod.full_name] = mod
+ if @store.unmatched_constant_alias[mod.full_name] then
+ to, file = @store.unmatched_constant_alias[mod.full_name]
+ add_module_alias mod, mod.name, to, file
+ end
end
mod
@@ -511,40 +516,52 @@ class RDoc::Context < RDoc::CodeObject
end
##
+ # Adds a module by +RDoc::NormalModule+ instance. See also #add_module.
+
+ def add_module_by_normal_module(mod)
+ add_class_or_module mod, @modules, @store.modules_hash
+ end
+
+ ##
# Adds an alias from +from+ (a class or module) to +name+ which was defined
# in +file+.
- def add_module_alias from, name, file
+ def add_module_alias from, from_name, to, file
return from if @done_documenting
- to_name = child_name name
+ to_full_name = child_name to.name
# if we already know this name, don't register an alias:
# see the metaprogramming in lib/active_support/basic_object.rb,
# where we already know BasicObject is a class when we find
# BasicObject = BlankSlate
- return from if @store.find_class_or_module to_name
+ return from if @store.find_class_or_module to_full_name
+
+ unless from
+ @store.unmatched_constant_alias[child_name(from_name)] = [to, file]
+ return to
+ end
- to = from.dup
- to.name = name
- to.full_name = nil
+ new_to = from.dup
+ new_to.name = to.name
+ new_to.full_name = nil
- if to.module? then
- @store.modules_hash[to_name] = to
- @modules[name] = to
+ if new_to.module? then
+ @store.modules_hash[to_full_name] = new_to
+ @modules[to.name] = new_to
else
- @store.classes_hash[to_name] = to
- @classes[name] = to
+ @store.classes_hash[to_full_name] = new_to
+ @classes[to.name] = new_to
end
# Registers a constant for this alias. The constant value and comment
# will be updated later, when the Ruby parser adds the constant
- const = RDoc::Constant.new name, nil, to.comment
+ const = RDoc::Constant.new to.name, nil, new_to.comment
const.record_location file
const.is_alias_for = from
add_constant const
- to
+ new_to
end
##
@@ -863,7 +880,13 @@ class RDoc::Context < RDoc::CodeObject
# Finds a method named +name+ with singleton value +singleton+.
def find_method(name, singleton)
- @method_list.find { |m| m.name == name && m.singleton == singleton }
+ @method_list.find { |m|
+ if m.singleton
+ m.name == name && m.singleton == singleton
+ else
+ m.name == name && !m.singleton && !singleton
+ end
+ }
end
##