Skip to content
Merged
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
11 changes: 1 addition & 10 deletions lib/rdoc/code_object/top_level.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class TopLevel < Context
##
# The parser class that processed this file

attr_reader :parser
attr_accessor :parser

##
# Creates a new TopLevel for the file at +absolute_name+. If documentation
Expand All @@ -62,15 +62,6 @@ def initialize(absolute_name, relative_name = absolute_name)
@classes_or_modules = []
end

##
# Sets the parser for this toplevel context, also the store.

def parser=(val)
@parser = val
@store&.cache_text_file(relative_name)
@parser
end

##
# An RDoc::TopLevel is equal to another with the same relative_name

Expand Down
21 changes: 3 additions & 18 deletions lib/rdoc/store.rb
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ def initialize(options, path: nil, type: nil)
@classes_hash = {}
@modules_hash = {}
@files_hash = {}
@text_files_hash = {}

@c_enclosure_classes = {}
@c_enclosure_names = {}
Expand Down Expand Up @@ -181,7 +180,6 @@ def add_file(absolute_name, relative_name: absolute_name, parser: nil)
top_level.parser = parser if parser
top_level.store = self
@files_hash[relative_name] = top_level
@text_files_hash[relative_name] = top_level if top_level.text?
@page_index = nil
end

Expand All @@ -200,7 +198,6 @@ def add_file(absolute_name, relative_name: absolute_name, parser: nil)

def remove_file(relative_name)
top_level = @files_hash.delete(relative_name)
@text_files_hash.delete(relative_name)
@c_class_variables.delete(relative_name)
@c_singleton_class_variables.delete(relative_name)
return unless top_level
Expand Down Expand Up @@ -316,15 +313,6 @@ def resolve_c_superclasses
end
end

##
# Caches +relative_name+ in the text files hash, if it is a text file.

def cache_text_file(relative_name)
if top_level = @files_hash[relative_name]
@text_files_hash[relative_name] = top_level if top_level.text?
end
end

##
# Returns all classes discovered by RDoc

Expand Down Expand Up @@ -639,9 +627,8 @@ def find_module_named(name)
# +file_name+

def find_text_page(file_name)
@text_files_hash.each_value.find do |file|
file.full_name == file_name
end
page = @files_hash[file_name]
page if page&.text?
end

##
Expand Down Expand Up @@ -747,9 +734,7 @@ def load_all

@page_index = nil
@cache[:pages].each do |page_name|
page = load_page page_name
@files_hash[page_name] = page
@text_files_hash[page_name] = page if page.text?
@files_hash[page_name] = load_page(page_name)
end
end

Expand Down