diff options
author | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-08-27 01:30:18 +0000 |
---|---|---|
committer | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-08-27 01:30:18 +0000 |
commit | 95e213d3542034e0fd2613de6990a7ddfe5718ca (patch) | |
tree | 76ec64fccb338dbcbc4d3f07c2f494ef9b7fe1ff /lib/rdoc/cross_reference.rb | |
parent | 41fb243684f60e231fc77ec54752fe4e844523d5 (diff) | |
download | ruby-95e213d3542034e0fd2613de6990a7ddfe5718ca.tar.gz |
Merge rdoc-6.1.0.beta1.
* https://github.com/ruby/rdoc/compare/v6.0.4...v6.1.0.beta1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64547 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rdoc/cross_reference.rb')
-rw-r--r-- | lib/rdoc/cross_reference.rb | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/lib/rdoc/cross_reference.rb b/lib/rdoc/cross_reference.rb index d76ebaf2d0..3f5f33ba42 100644 --- a/lib/rdoc/cross_reference.rb +++ b/lib/rdoc/cross_reference.rb @@ -19,7 +19,7 @@ class RDoc::CrossReference # # See CLASS_REGEXP_STR - METHOD_REGEXP_STR = '([a-z]\w*[!?=]?|%|===|\[\]=?|<<|>>)(?:\([\w.+*/=<>-]*\))?' + METHOD_REGEXP_STR = '([a-z]\w*[!?=]?|%|===|\[\]=?|<<|>>|-|\+|\*)(?:\([\w.+*/=<>-]*\))?' ## # Regular expressions matching text that should potentially have @@ -127,23 +127,41 @@ class RDoc::CrossReference if /#{CLASS_REGEXP_STR}([.#]|::)#{METHOD_REGEXP_STR}/o =~ name then type = $2 - type = '' if type == '.' # will find either #method or ::method - method = "#{type}#{$3}" + if '.' == type # will find either #method or ::method + method = $3 + else + method = "#{type}#{$3}" + end container = @context.find_symbol_module($1) elsif /^([.#]|::)#{METHOD_REGEXP_STR}/o =~ name then type = $1 - type = '' if type == '.' - method = "#{type}#{$2}" + if '.' == type + method = $2 + else + method = "#{type}#{$2}" + end container = @context else + type = nil container = nil end if container then - ref = container.find_local_symbol method - - unless ref || RDoc::TopLevel === container then - ref = container.find_ancestor_local_symbol method + unless RDoc::TopLevel === container then + if '.' == type then + if 'new' == method then # AnyClassName.new will be class method + ref = container.find_local_symbol method + ref = container.find_ancestor_local_symbol method unless ref + else + ref = container.find_local_symbol "::#{method}" + ref = container.find_ancestor_local_symbol "::#{method}" unless ref + ref = container.find_local_symbol "##{method}" unless ref + ref = container.find_ancestor_local_symbol "##{method}" unless ref + end + else + ref = container.find_local_symbol method + ref = container.find_ancestor_local_symbol method unless ref + end end end |