Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 3 additions & 12 deletions lib/rdoc/code_object/context.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Comment on lines 559 to 560

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
Expand Down
2 changes: 1 addition & 1 deletion lib/rdoc/parser/ruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 0 additions & 7 deletions lib/rdoc/store.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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+

Expand Down Expand Up @@ -154,8 +149,6 @@ def initialize(options, path: nil, type: nil)

@unique_classes = nil
@unique_modules = nil

@unmatched_constant_alias = {}
end

##
Expand Down
8 changes: 4 additions & 4 deletions test/rdoc/code_object/class_module_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion test/rdoc/generator/aliki_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion test/rdoc/generator/darkfish_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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!'
Expand Down
4 changes: 2 additions & 2 deletions test/rdoc/rdoc_context_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion test/rdoc/rdoc_store_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down