From 49ecbb73cc188b7eadac6cd1a459b3649a3262dc Mon Sep 17 00:00:00 2001 From: drbrain Date: Mon, 14 Jan 2008 03:34:05 +0000 Subject: Renamespace lib/rdoc/markup from SM::SimpleMarkup to RDoc::Markup. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@15033 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/rdoc/code_objects.rb | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) (limited to 'lib/rdoc/code_objects.rb') diff --git a/lib/rdoc/code_objects.rb b/lib/rdoc/code_objects.rb index d75670de7..dfc0fff9c 100644 --- a/lib/rdoc/code_objects.rb +++ b/lib/rdoc/code_objects.rb @@ -458,7 +458,7 @@ module RDoc end - + ## # A TopLevel context is a source file class TopLevel < Context @@ -470,7 +470,7 @@ module RDoc @@all_classes = {} @@all_modules = {} - def TopLevel::reset + def self.reset @@all_classes = {} @@all_modules = {} end @@ -488,14 +488,15 @@ module RDoc nil end - # Adding a class or module to a TopLevel is special, as we only - # want one copy of a particular top-level class. For example, - # if both file A and file B implement class C, we only want one - # ClassModule object for C. This code arranges to share - # classes and modules between files. + ## + # Adding a class or module to a TopLevel is special, as we only want one + # copy of a particular top-level class. For example, if both file A and + # file B implement class C, we only want one ClassModule object for C. + # This code arranges to share classes and modules between files. def add_class_or_module(collection, class_type, name, superclass) cls = collection[name] + if cls puts "Reusing class/module #{name}" if $DEBUG_RDOC else @@ -504,23 +505,29 @@ module RDoc else all = @@all_classes end + cls = all[name] + if !cls cls = class_type.new(name, superclass) - all[name] = cls unless @done_documenting + all[name] = cls unless @done_documenting end - puts "Adding class/module #{name} to #@name" if $DEBUG_RDOC + + puts "Adding class/module #{name} to #{@name}" if $DEBUG_RDOC + collection[name] = cls unless @done_documenting + cls.parent = self end + cls end - def TopLevel.all_classes_and_modules + def self.all_classes_and_modules @@all_classes.values + @@all_modules.values end - def TopLevel.find_class_named(name) + def self.find_class_named(name) @@all_classes.each_value do |c| res = c.find_class_named(name) return res if res @@ -538,12 +545,13 @@ module RDoc nil end + ## # Find a named module + def find_module_named(name) find_class_or_module_named(name) || find_enclosing_module_named(name) end - end # ClassModule is the base class for objects representing either a -- cgit