diff --git a/lib/rdoc/code_object/context.rb b/lib/rdoc/code_object/context.rb index 7de435ee38..fb8d9a4f69 100644 --- a/lib/rdoc/code_object/context.rb +++ b/lib/rdoc/code_object/context.rb @@ -407,10 +407,6 @@ def add_class_or_module(mod, self_hash, all_hash) # 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 @@ -549,10 +545,10 @@ def add_module_by_normal_module(mod) end ## - # Adds an alias from +from+ (a class or module) to +name+ which was defined - # in +file+. + # Adds an alias from +from+ (a class or module) to the constant +to+ which + # was defined in +file+. - def add_module_alias(from, from_name, to, file) + def add_module_alias(from, to, file) return from if @done_documenting to_full_name = child_name to.name @@ -563,11 +559,6 @@ def add_module_alias(from, from_name, to, file) # BasicObject = BlankSlate 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 - new_to = from.dup new_to.name = to.name new_to.full_name = nil diff --git a/lib/rdoc/parser/ruby.rb b/lib/rdoc/parser/ruby.rb index 5894850157..c1c94f68f1 100644 --- a/lib/rdoc/parser/ruby.rb +++ b/lib/rdoc/parser/ruby.rb @@ -871,7 +871,7 @@ def add_constant(constant_name, rhs_name, start_line, end_line, alias_path: nil) @store.find_class_or_module(full_name) end if mod && constant.document_self - a = owner.add_module_alias(mod, alias_path, constant, @top_level) + a = owner.add_module_alias(mod, constant, @top_level) a.store = @store a.line = start_line record_location(a) diff --git a/lib/rdoc/store.rb b/lib/rdoc/store.rb index df58a1b354..bc46bc408d 100644 --- a/lib/rdoc/store.rb +++ b/lib/rdoc/store.rb @@ -112,11 +112,6 @@ def message # :nodoc: attr_accessor :encoding - ## - # The lazy constants alias will be discovered in passing - - attr_reader :unmatched_constant_alias - ## # Creates a new Store of +type+ that will load or save to +path+ @@ -154,8 +149,6 @@ def initialize(options, path: nil, type: nil) @unique_classes = nil @unique_modules = nil - - @unmatched_constant_alias = {} end ## diff --git a/test/rdoc/code_object/class_module_test.rb b/test/rdoc/code_object/class_module_test.rb index af8e8af815..bff19a1513 100644 --- a/test/rdoc/code_object/class_module_test.rb +++ b/test/rdoc/code_object/class_module_test.rb @@ -1363,7 +1363,7 @@ def test_update_aliases_class n1_k2 = n1.add_module RDoc::NormalClass, 'N2' a1 = RDoc::Constant.new 'A1', '', '' - n1.add_module_alias n1_k2, n1_k2.name, a1, @xref_data + n1.add_module_alias n1_k2, a1, @xref_data n1_a1_c = n1.constants.find { |c| c.name == 'A1' } refute_nil n1_a1_c @@ -1388,7 +1388,7 @@ def test_update_aliases_module n1_n2 = n1.add_module RDoc::NormalModule, 'N2' a1 = RDoc::Constant.new 'A1', '', '' - n1.add_module_alias n1_n2, n1_n2.name, a1, @xref_data + n1.add_module_alias n1_n2, a1, @xref_data n1_a1_c = n1.constants.find { |c| c.name == 'A1' } refute_nil n1_a1_c @@ -1414,7 +1414,7 @@ def test_update_aliases_reparent o1 = @xref_data.add_module RDoc::NormalModule, 'O1' a1 = RDoc::Constant.new 'A1', '', '' - o1.add_module_alias l1_l2, l1_l2.name, a1, @xref_data + o1.add_module_alias l1_l2, a1, @xref_data o1_a1_c = o1.constants.find { |c| c.name == 'A1' } refute_nil o1_a1_c @@ -1447,7 +1447,7 @@ def test_update_aliases_reparent_root const.is_alias_for = klass a = RDoc::Constant.new 'A', '', '' - top_level.add_module_alias klass, klass.name, a, top_level + top_level.add_module_alias klass, a, top_level object.add_constant const diff --git a/test/rdoc/generator/aliki_test.rb b/test/rdoc/generator/aliki_test.rb index 50742b0df4..081cd19588 100644 --- a/test/rdoc/generator/aliki_test.rb +++ b/test/rdoc/generator/aliki_test.rb @@ -39,7 +39,7 @@ def setup @top_level.add_constant @alias_constant - @klass.add_module_alias @klass, @klass.name, @alias_constant, @top_level + @klass.add_module_alias @klass, @alias_constant, @top_level @meth = RDoc::AnyMethod.new 'method' @meth_with_html_tag_yield = RDoc::AnyMethod.new 'method_with_html_tag_yield' diff --git a/test/rdoc/generator/darkfish_test.rb b/test/rdoc/generator/darkfish_test.rb index 34c8431219..966a8f2d2e 100644 --- a/test/rdoc/generator/darkfish_test.rb +++ b/test/rdoc/generator/darkfish_test.rb @@ -39,7 +39,7 @@ def setup @top_level.add_constant @alias_constant - @klass.add_module_alias @klass, @klass.name, @alias_constant, @top_level + @klass.add_module_alias @klass, @alias_constant, @top_level @meth = RDoc::AnyMethod.new 'method' @meth_bang = RDoc::AnyMethod.new 'method!' diff --git a/test/rdoc/rdoc_context_test.rb b/test/rdoc/rdoc_context_test.rb index 24536fa26e..04f84ed433 100644 --- a/test/rdoc/rdoc_context_test.rb +++ b/test/rdoc/rdoc_context_test.rb @@ -295,7 +295,7 @@ def test_add_module_alias tl = @store.add_file 'file.rb' c4 = RDoc::Constant.new 'C4', '', '' - c3_c4 = @c2.add_module_alias @c2_c3, @c2_c3.name, c4, tl + c3_c4 = @c2.add_module_alias @c2_c3, c4, tl alias_constant = @c2.constants.first @@ -314,7 +314,7 @@ def test_add_module_alias_top_level object = top_level.add_class RDoc::NormalClass, 'Object' a = RDoc::Constant.new 'A', '', '' - top_level.add_module_alias klass, klass.name, a, top_level + top_level.add_module_alias klass, a, top_level refute_empty object.constants diff --git a/test/rdoc/rdoc_store_test.rb b/test/rdoc/rdoc_store_test.rb index 76f2a079a5..34e3ade60a 100644 --- a/test/rdoc/rdoc_store_test.rb +++ b/test/rdoc/rdoc_store_test.rb @@ -222,7 +222,7 @@ def test_classes def test_complete a1 = RDoc::Constant.new 'A1', '', '' - @c2.add_module_alias @c2_c3, @c2_c3.name, a1, @top_level + @c2.add_module_alias @c2_c3, a1, @top_level @store.complete :public