ruby-changes:50745
From: hsbt <ko1@a...>
Date: Mon, 26 Mar 2018 14:56:38 +0900 (JST)
Subject: [ruby-changes:50745] hsbt:r62924 (trunk): Merge RDoc 6.0.3 from upstream.
hsbt 2018-03-26 14:56:26 +0900 (Mon, 26 Mar 2018) New Revision: 62924 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=62924 Log: Merge RDoc 6.0.3 from upstream. It fixed the several bugs that was found after RDoc 6 releasing. From: SHIBATA Hiroshi <hsbt@r...> Added files: trunk/test/rdoc/minitest_helper.rb Removed files: trunk/lib/rdoc/test_case.rb Modified files: trunk/lib/rdoc/context.rb trunk/lib/rdoc/encoding.rb trunk/lib/rdoc/erbio.rb trunk/lib/rdoc/generator/json_index.rb trunk/lib/rdoc/generator/pot.rb trunk/lib/rdoc/i18n.rb trunk/lib/rdoc/markdown/literals.rb trunk/lib/rdoc/markdown.rb trunk/lib/rdoc/markup/pre_process.rb trunk/lib/rdoc/options.rb trunk/lib/rdoc/parser/ripper_state_lex.rb trunk/lib/rdoc/parser/ruby.rb trunk/lib/rdoc/parser.rb trunk/lib/rdoc/rd/block_parser.rb trunk/lib/rdoc/rd/inline_parser.rb trunk/lib/rdoc/rdoc.gemspec trunk/lib/rdoc/rdoc.rb trunk/lib/rdoc/ri/driver.rb trunk/lib/rdoc/servlet.rb trunk/lib/rdoc/store.rb trunk/lib/rdoc/text.rb trunk/lib/rdoc/token_stream.rb trunk/lib/rdoc.rb trunk/test/rdoc/test_rdoc_any_method.rb trunk/test/rdoc/test_rdoc_attr.rb trunk/test/rdoc/test_rdoc_class_module.rb trunk/test/rdoc/test_rdoc_code_object.rb trunk/test/rdoc/test_rdoc_comment.rb trunk/test/rdoc/test_rdoc_constant.rb trunk/test/rdoc/test_rdoc_context.rb trunk/test/rdoc/test_rdoc_context_section.rb trunk/test/rdoc/test_rdoc_encoding.rb trunk/test/rdoc/test_rdoc_generator_darkfish.rb trunk/test/rdoc/test_rdoc_generator_json_index.rb trunk/test/rdoc/test_rdoc_generator_markup.rb trunk/test/rdoc/test_rdoc_generator_pot.rb trunk/test/rdoc/test_rdoc_generator_pot_po.rb trunk/test/rdoc/test_rdoc_generator_pot_po_entry.rb trunk/test/rdoc/test_rdoc_generator_ri.rb trunk/test/rdoc/test_rdoc_i18n_locale.rb trunk/test/rdoc/test_rdoc_i18n_text.rb trunk/test/rdoc/test_rdoc_markdown.rb trunk/test/rdoc/test_rdoc_markup.rb trunk/test/rdoc/test_rdoc_markup_attribute_manager.rb trunk/test/rdoc/test_rdoc_markup_attributes.rb trunk/test/rdoc/test_rdoc_markup_document.rb trunk/test/rdoc/test_rdoc_markup_formatter.rb trunk/test/rdoc/test_rdoc_markup_hard_break.rb trunk/test/rdoc/test_rdoc_markup_heading.rb trunk/test/rdoc/test_rdoc_markup_include.rb trunk/test/rdoc/test_rdoc_markup_indented_paragraph.rb trunk/test/rdoc/test_rdoc_markup_paragraph.rb trunk/test/rdoc/test_rdoc_markup_parser.rb trunk/test/rdoc/test_rdoc_markup_pre_process.rb trunk/test/rdoc/test_rdoc_markup_raw.rb trunk/test/rdoc/test_rdoc_markup_to_ansi.rb trunk/test/rdoc/test_rdoc_markup_to_bs.rb trunk/test/rdoc/test_rdoc_markup_to_html.rb trunk/test/rdoc/test_rdoc_markup_to_html_snippet.rb trunk/test/rdoc/test_rdoc_markup_to_joined_paragraph.rb trunk/test/rdoc/test_rdoc_markup_to_label.rb trunk/test/rdoc/test_rdoc_markup_to_markdown.rb trunk/test/rdoc/test_rdoc_markup_to_rdoc.rb trunk/test/rdoc/test_rdoc_markup_to_table_of_contents.rb trunk/test/rdoc/test_rdoc_markup_to_tt_only.rb trunk/test/rdoc/test_rdoc_markup_verbatim.rb trunk/test/rdoc/test_rdoc_options.rb trunk/test/rdoc/test_rdoc_parser.rb trunk/test/rdoc/test_rdoc_parser_c.rb trunk/test/rdoc/test_rdoc_parser_changelog.rb trunk/test/rdoc/test_rdoc_parser_markdown.rb trunk/test/rdoc/test_rdoc_parser_rd.rb trunk/test/rdoc/test_rdoc_parser_ruby.rb trunk/test/rdoc/test_rdoc_parser_simple.rb trunk/test/rdoc/test_rdoc_rd.rb trunk/test/rdoc/test_rdoc_rd_block_parser.rb trunk/test/rdoc/test_rdoc_rd_inline.rb trunk/test/rdoc/test_rdoc_rd_inline_parser.rb trunk/test/rdoc/test_rdoc_rdoc.rb trunk/test/rdoc/test_rdoc_ri_driver.rb trunk/test/rdoc/test_rdoc_ri_paths.rb trunk/test/rdoc/test_rdoc_rubygems_hook.rb trunk/test/rdoc/test_rdoc_servlet.rb trunk/test/rdoc/test_rdoc_single_class.rb trunk/test/rdoc/test_rdoc_stats.rb trunk/test/rdoc/test_rdoc_store.rb trunk/test/rdoc/test_rdoc_task.rb trunk/test/rdoc/test_rdoc_text.rb trunk/test/rdoc/test_rdoc_token_stream.rb trunk/test/rdoc/test_rdoc_tom_doc.rb trunk/test/rdoc/test_rdoc_top_level.rb trunk/test/rdoc/xref_data.rb trunk/test/rdoc/xref_test_case.rb Index: lib/rdoc/test_case.rb =================================================================== --- lib/rdoc/test_case.rb (revision 62923) +++ lib/rdoc/test_case.rb (nonexistent) @@ -1,203 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/lib/rdoc/test_case.rb#L0 -# frozen_string_literal: true -begin - gem 'minitest', '~> 4.0' unless defined?(Test::Unit) -rescue NoMethodError, Gem::LoadError - # for ruby tests -end - -require 'minitest/autorun' -require 'minitest/benchmark' unless ENV['NOBENCHMARK'] - -require 'fileutils' -require 'pp' -require 'tempfile' -require 'tmpdir' -require 'stringio' - -require 'rdoc' - -## -# RDoc::TestCase is an abstract TestCase to provide common setup and teardown -# across all RDoc tests. The test case uses minitest, so all the assertions -# of minitest may be used. -# -# The testcase provides the following: -# -# * A reset code-object tree -# * A reset markup preprocessor (RDoc::Markup::PreProcess) -# * The <code>@RM</code> alias of RDoc::Markup (for less typing) -# * <code>@pwd</code> containing the current working directory -# * FileUtils, pp, Tempfile, Dir.tmpdir and StringIO - -class RDoc::TestCase < MiniTest::Unit::TestCase - - ## - # Abstract test-case setup - - def setup - super - - @top_level = nil - - @RM = RDoc::Markup - - @pwd = Dir.pwd - - @store = RDoc::Store.new - - @rdoc = RDoc::RDoc.new - @rdoc.store = @store - @rdoc.options = RDoc::Options.new - - g = Object.new - def g.class_dir() end - def g.file_dir() end - @rdoc.generator = g - - RDoc::Markup::PreProcess.reset - end - - ## - # Asserts +path+ is a file - - def assert_file path - assert File.file?(path), "#{path} is not a file" - end - - ## - # Asserts +path+ is a directory - - def assert_directory path - assert File.directory?(path), "#{path} is not a directory" - end - - ## - # Refutes +path+ exists - - def refute_file path - refute File.exist?(path), "#{path} exists" - end - - ## - # Shortcut for RDoc::Markup::BlankLine.new - - def blank_line - @RM::BlankLine.new - end - - ## - # Shortcut for RDoc::Markup::BlockQuote.new with +contents+ - - def block *contents - @RM::BlockQuote.new(*contents) - end - - ## - # Creates an RDoc::Comment with +text+ which was defined on +top_level+. - # By default the comment has the 'rdoc' format. - - def comment text, top_level = @top_level - RDoc::Comment.new text, top_level - end - - ## - # Shortcut for RDoc::Markup::Document.new with +contents+ - - def doc *contents - @RM::Document.new(*contents) - end - - ## - # Shortcut for RDoc::Markup::HardBreak.new - - def hard_break - @RM::HardBreak.new - end - - ## - # Shortcut for RDoc::Markup::Heading.new with +level+ and +text+ - - def head level, text - @RM::Heading.new level, text - end - - ## - # Shortcut for RDoc::Markup::ListItem.new with +label+ and +parts+ - - def item label = nil, *parts - @RM::ListItem.new label, *parts - end - - ## - # Shortcut for RDoc::Markup::List.new with +type+ and +items+ - - def list type = nil, *items - @RM::List.new type, *items - end - - ## - # Enables pretty-print output - - def mu_pp obj # :nodoc: - s = obj.pretty_inspect - s = RDoc::Encoding.change_encoding s, Encoding.default_external - s.chomp - end - - ## - # Shortcut for RDoc::Markup::Paragraph.new with +contents+ - - def para *a - @RM::Paragraph.new(*a) - end - - ## - # Shortcut for RDoc::Markup::Rule.new with +weight+ - - def rule weight - @RM::Rule.new weight - end - - ## - # Shortcut for RDoc::Markup::Raw.new with +contents+ - - def raw *contents - @RM::Raw.new(*contents) - end - - ## - # Creates a temporary directory changes the current directory to it for the - # duration of the block. - # - # Depends upon Dir.mktmpdir - - def temp_dir - Dir.mktmpdir do |temp_dir| - Dir.chdir temp_dir do - yield temp_dir - end - end - end - - ## - # Shortcut for RDoc::Markup::Verbatim.new with +parts+ - - def verb *parts - @RM::Verbatim.new(*parts) - end - - ## - # run capture_io with setting $VERBOSE = true - - def verbose_capture_io - capture_io do - begin - orig_verbose = $VERBOSE - $VERBOSE = true - yield - ensure - $VERBOSE = orig_verbose - end - end - end -end Property changes on: lib/rdoc/test_case.rb ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -LF \ No newline at end of property Index: test/rdoc/test_rdoc_markup_to_bs.rb =================================================================== --- test/rdoc/test_rdoc_markup_to_bs.rb (revision 62923) +++ test/rdoc/test_rdoc_markup_to_bs.rb (revision 62924) @@ -1,5 +1,5 @@ https://github.com/ruby/ruby/blob/trunk/test/rdoc/test_rdoc_markup_to_bs.rb#L1 # frozen_string_literal: true -require 'rdoc/test_case' +require 'minitest_helper' class TestRDocMarkupToBs < RDoc::Markup::TextFormatterTestCase Index: test/rdoc/test_rdoc_rd_block_parser.rb =================================================================== --- test/rdoc/test_rdoc_rd_block_parser.rb (revision 62923) +++ test/rdoc/test_rdoc_rd_block_parser.rb (revision 62924) @@ -1,5 +1,5 @@ https://github.com/ruby/ruby/blob/trunk/test/rdoc/test_rdoc_rd_block_parser.rb#L1 # frozen_string_literal: true -require 'rdoc/test_case' +require 'minitest_helper' class TestRDocRdBlockParser < RDoc::TestCase Index: test/rdoc/test_rdoc_single_class.rb =================================================================== --- test/rdoc/test_rdoc_single_class.rb (revision 62923) +++ test/rdoc/test_rdoc_single_class.rb (revision 62924) @@ -1,5 +1,5 @@ https://github.com/ruby/ruby/blob/trunk/test/rdoc/test_rdoc_single_class.rb#L1 # frozen_string_literal: true -require 'rdoc/test_case' +require 'minitest_helper' class TestRDocSingleClass < RDoc::TestCase Index: test/rdoc/test_rdoc_markup_to_tt_only.rb =================================================================== --- test/rdoc/test_rdoc_markup_to_tt_only.rb (revision 62923) +++ test/rdoc/test_rdoc_markup_to_tt_only.rb (revision 62924) @@ -1,5 +1,5 @@ https://github.com/ruby/ruby/blob/trunk/test/rdoc/test_rdoc_markup_to_tt_only.rb#L1 # frozen_string_literal: true -require 'rdoc/test_case' +require 'minitest_helper' class TestRDocMarkupToTtOnly < RDoc::Markup::FormatterTestCase Index: test/rdoc/test_rdoc_markup_to_joined_paragraph.rb =================================================================== --- test/rdoc/test_rdoc_markup_to_joined_paragraph.rb (revision 62923) +++ test/rdoc/test_rdoc_markup_to_joined_paragraph.rb (revision 62924) @@ -1,5 +1,5 @@ https://github.com/ruby/ruby/blob/trunk/test/rdoc/test_rdoc_markup_to_joined_paragraph.rb#L1 # frozen_string_literal: true -require 'rdoc/test_case' +require 'minitest_helper' class TestRDocMarkupToJoinedParagraph < RDoc::TestCase Index: test/rdoc/test_rdoc_i18n_text.rb =================================================================== --- test/rdoc/test_rdoc_i18n_text.rb (revision 62923) +++ test/rdoc/test_rdoc_i18n_text.rb (revision 62924) @@ -1,5 +1,5 @@ https://github.com/ruby/ruby/blob/trunk/test/rdoc/test_rdoc_i18n_text.rb#L1 # frozen_string_literal: true -require 'rdoc/test_case' +require 'minitest_helper' class TestRDocI18nText < RDoc::TestCase Index: test/rdoc/minitest_helper.rb =================================================================== --- test/rdoc/minitest_helper.rb (nonexistent) +++ test/rdoc/minitest_helper.rb (revision 62924) @@ -0,0 +1,203 @@ https://github.com/ruby/ruby/blob/trunk/test/rdoc/minitest_helper.rb#L1 +# frozen_string_literal: true +begin + gem 'minitest', '~> 5.0' +rescue NoMethodError, Gem::LoadError + # for ruby tests +end + +require 'minitest/autorun' +require 'minitest/benchmark' unless ENV['NOBENCHMARK'] + +require 'fileutils' +require 'pp' +require 'tempfile' +require 'tmpdir' +require 'stringio' + +require 'rdoc' + +## +# RDoc::TestCase is an abstract TestCase to provide common setup and teardown +# across all RDoc tests. The test case uses minitest, so all the assertions +# of minitest may be used. +# +# The testcase provides the following: +# +# * A reset code-object tree +# * A reset markup preprocessor (RDoc::Markup::PreProcess) +# * The <code>@RM</code> alias of RDoc::Markup (for less typing) +# * <code>@pwd</code> containing the current working directory +# * FileUtils, pp, Tempfile, Dir.tmpdir and StringIO + +class RDoc::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Unit::TestCase) + + ## + # Abstract test-case setup + + def setup + super + + @top_level = nil + + @RM = RDoc::Markup + + @pwd = Dir.pwd + + @store = RDoc::Store.new + + @rdoc = RDoc::RDoc.new + @rdoc.store = @store + @rdoc.options = RDoc::Options.new + + g = Object.new + def g.class_dir() end + def g.file_dir() end + @rdoc.generator = g + + RDoc::Markup::PreProcess.reset + end + + ## + # Asserts +path+ is a file + + def assert_file path + assert File.file?(path), "#{path} is not a file" + end + + ## + # Asserts +path+ is a directory + + def assert_directory path + assert File.directory?(path), "#{path} is not a directory" + end + + ## + # Refutes +path+ exists + + def refute_file path + refute File.exist?(path), "#{path} exists" + end + + ## + # Shortcut for RDoc::Markup::BlankLine.new + + def blank_line + @RM::BlankLine.new + end + + ## + # Shortcut for RDoc::Markup::BlockQuote.new with +contents+ + + def block *contents + @RM::BlockQuote.new(*contents) + end + + ## + # Creates an RDoc::Comment with +text+ which was defined on +top_level+. + # By default the comment has the 'rdoc' format. + + def comment text, top_level = @top_level + RDoc::Comment.new text, top_level + end + + ## + # Shortcut for RDoc::Markup::Document.new with +contents+ + + def doc *contents + @RM::Document.new(*contents) + end + + ## + # Shortcut for RDoc::Markup::HardBreak.new + + def hard_break + @RM::HardBreak.new + end + + ## + # Shortcut for RDoc::Markup::Heading.new with +level+ and +text+ + + def head level, text + @RM::Heading.new level, text + end + + ## + # Shortcut for RDoc::Markup::ListItem.new with +label+ and +parts+ + + def item label = nil, *parts + @RM::ListItem.new label, *parts + end + + ## + # Shortcut for RDoc::Markup::List.new with +type+ and +items+ + + def list type = nil, *items + @RM::List.new type, *items + end + + ## + # Enables pretty-print output + + def mu_pp obj # :nodoc: + s = obj.pretty_inspect + s = RDoc::Encoding.change_encoding s, Encoding.default_external + s.chomp + end + + ## + # Shortcut for RDoc::Markup::Paragraph.new with +contents+ + + def para *a + @RM::Paragraph.new(*a) + end + + ## + # Shortcut for RDoc::Markup::Rule.new with +weight+ + + def rule weight + @RM::Rule.new weight + end + + ## + # Shortcut for RDoc::Markup::Raw.new with +contents+ + + def raw *contents + @RM::Raw.new(*contents) + end + + ## + # Creates a temporary directory changes the current directory to it for the + # duration of the block. + # + # Depends upon Dir.mktmpdir + + def temp_dir + Dir.mktmpdir do |temp_dir| + Dir.chdir temp_dir do + yield temp_dir + end + end + end + + ## + # Shortcut for RDoc::Markup::Verbatim.new with +parts+ + + def verb *parts + @RM::Verbatim.new(*parts) + end + + ## + # run capture_io with setting $VERBOSE = true + + def verbose_capture_io + capture_io do + begin + orig_verbose = $VERBOSE + $VERBOSE = true + yield + ensure + $VERBOSE = orig_verbose + end + end + end +end Property changes on: test/rdoc/minitest_helper.rb ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +LF \ No newline at end of property Index: test/rdoc/xref_test_case.rb =================================================================== --- test/rdoc/xref_test_case.rb (revision 62923) +++ test/rdoc/xref_test_case.rb (revision 62924) @@ -1,7 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/test/rdoc/xref_test_case.rb#L1 # frozen_string_literal: true ENV['RDOC_TEST'] = 'yes' -require 'rdoc' +require 'minitest_helper' require File.expand_path '../xref_data', __FILE__ class XrefTestCase < RDoc::TestCase @@ -53,6 +53,8 @@ class XrefTestCase < RDoc::TestCase https://github.com/ruby/ruby/blob/trunk/test/rdoc/xref_test_case.rb#L53 @c3_h2 = @xref_data.find_module_named 'C3::H2' @c6 = @xref_data.find_module_named 'C6' @c7 = @xref_data.find_module_named 'C7' + @c8 = @xref_data.find_module_named 'C8' + @c8_s1 = @xref_data.find_module_named 'C8::S1' @m1 = @xref_data.find_module_named 'M1' @m1_m = @m1.method_list.first Index: test/rdoc/test_rdoc_markup_document.rb =================================================================== --- test/rdoc/test_rdoc_markup_document.rb (revision 62923) +++ test/rdoc/test_rdoc_markup_document.rb (revision 62924) @@ -1,5 +1,5 @@ https://github.com/ruby/ruby/blob/trunk/test/rdoc/test_rdoc_markup_document.rb#L1 # frozen_string_literal: true -require 'rdoc/test_case' +require 'minitest_helper' class TestRDocMarkupDocument < RDoc::TestCase Index: lib/rdoc.rb =================================================================== --- lib/rdoc.rb (revision 62923) +++ lib/rdoc.rb (revision 62924) @@ -65,7 +65,7 @@ module RDoc https://github.com/ruby/ruby/blob/trunk/lib/rdoc.rb#L65 ## # RDoc version you are using - VERSION = '6.0.1' + VERSION = '6.0.3' ## # Method visibilities @@ -125,8 +125,6 @@ module RDoc https://github.com/ruby/ruby/blob/trunk/lib/rdoc.rb#L125 autoload :RDoc, 'rdoc/rdoc' - autoload :TestCase, 'rdoc/test_case' - autoload :CrossReference, 'rdoc/cross_reference' autoload :ERBIO, 'rdoc/erbio' autoload :ERBPartial, 'rdoc/erb_partial' @@ -153,7 +151,7 @@ module RDoc https://github.com/ruby/ruby/blob/trunk/lib/rdoc.rb#L151 autoload :Comment, 'rdoc/comment' - autoload :I18n, 'rdoc/i18n' + require 'rdoc/i18n' # code objects # Index: lib/rdoc/markdown.rb =================================================================== --- lib/rdoc/markdown.rb (revision 62923) +++ lib/rdoc/markdown.rb (revision 62924) @@ -1,4 +1,5 @@ https://github.com/ruby/ruby/blob/trunk/lib/rdoc/markdown.rb#L1 # coding: UTF-8 +# frozen_string_literal: true # :markup: markdown ## Index: lib/rdoc/generator/json_index.rb =================================================================== --- lib/rdoc/generator/json_index.rb (revision 62923) +++ lib/rdoc/generator/json_index.rb (revision 62924) @@ -147,12 +147,15 @@ class RDoc::Generator::JsonIndex https://github.com/ruby/ruby/blob/trunk/lib/rdoc/generator/json_index.rb#L147 JSON.dump data, io, 0 end + unless ENV['SOURCE_DATE_EPOCH'].nil? + index_file.utime index_file.atime, Time.at(ENV['SOURCE_DATE_EPOCH'].to_i).gmtime + end Dir.chdir @template_dir do Dir['**/*.js'].each do |source| dest = File.join out_dir, source - FileUtils.install source, dest, :mode => 0644, :verbose => $DEBUG_RDOC + FileUtils.install source, dest, :mode => 0644, :preserve => true, :verbose => $DEBUG_RDOC end end end Index: lib/rdoc/generator/pot.rb =================================================================== --- lib/rdoc/generator/pot.rb (revision 62923) +++ lib/rdoc/generator/pot.rb (revision 62924) @@ -91,8 +91,8 @@ class RDoc::Generator::POT https://github.com/ruby/ruby/blob/trunk/lib/rdoc/generator/pot.rb#L91 extractor.extract end - autoload :MessageExtractor, 'rdoc/generator/pot/message_extractor' - autoload :PO, 'rdoc/generator/pot/po' - autoload :POEntry, 'rdoc/generator/pot/po_entry' + require 'rdoc/generator/pot/message_extractor' + require 'rdoc/generator/pot/po' + require 'rdoc/generator/pot/po_entry' end Index: lib/rdoc/context.rb =================================================================== --- lib/rdoc/context.rb (revision 62923) +++ lib/rdoc/context.rb (revision 62924) @@ -407,6 +407,7 @@ class RDoc::Context < RDoc::CodeObject https://github.com/ruby/ruby/blob/trunk/lib/rdoc/context.rb#L407 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 https://github.com/ruby/ruby/blob/trunk/lib/rdoc/context.rb#L415 # 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 https://github.com/ruby/ruby/blob/trunk/lib/rdoc/context.rb#L516 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 - to = from.dup - to.name = name - to.full_name = nil - - if to.module? then - @store.modules_hash[to_name] = to - @modules[name] = to + 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 + + 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 https://github.com/ruby/ruby/blob/trunk/lib/rdoc/context.rb#L880 # 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 ## Index: lib/rdoc/rdoc.rb =================================================================== --- lib/rdoc/rdoc.rb (revision 62923) +++ lib/rdoc/rdoc.rb (revision 62924) @@ -36,11 +36,6 @@ class RDoc::RDoc https://github.com/ruby/ruby/blob/trunk/lib/rdoc/rdoc.rb#L36 GENERATORS = {} ## - # File pattern to exclude - - attr_accessor :exclude - - ## (... truncated) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/