From 5b76f13a8966e86c9fc0e1b0b8c84c71f54c7b82 Mon Sep 17 00:00:00 2001 From: dave Date: Tue, 30 Dec 2003 03:33:35 +0000 Subject: Fix problem when class and method names the same git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5349 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 7 +++++++ lib/rdoc/code_objects.rb | 23 +++++++++++++++++------ 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index ea03bbf5a6..782431fa35 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Tue Dec 30 12:30:30 2003 Dave Thomas + + * lib/rdoc/code_objects.rb (RDoc::Context::find_symbol): If a + class and a method have the same name, finding Xxx.abc was trying + to find 'abc' in method 'Xxx', not class 'Xxx'. + + Tue Dec 30 08:32:32 2003 Dave Thomas * lib/rdoc/parsers/parse_rb.rb (RDoc::RubyParser::parse_method): diff --git a/lib/rdoc/code_objects.rb b/lib/rdoc/code_objects.rb index bfacff1321..f5b4e81853 100644 --- a/lib/rdoc/code_objects.rb +++ b/lib/rdoc/code_objects.rb @@ -320,17 +320,28 @@ module RDoc end end else - result = find_local_symbol(symbol) - if result.nil? - if symbol =~ /^[A-Z]/ - result = parent - while result && result.name != symbol - result = result.parent + # if a method is specified, then we're definitely looking for + # a module, otherwise it could be any symbol + if method + result = find_module_named(symbol) + else + result = find_local_symbol(symbol) + if result.nil? + if symbol =~ /^[A-Z]/ + result = parent + while result && result.name != symbol + result = result.parent + end end end end end if result && method + if !result.respond_to?(:find_local_symbol) + p result.name + p method + fail + end result = result.find_local_symbol(method) end result -- cgit v1.2.3