diff options
author | Mike Dalessio <[email protected]> | 2024-11-30 07:31:36 -0500 |
---|---|---|
committer | git <[email protected]> | 2024-11-30 12:31:42 +0000 |
commit | 2923f42ed7622f6310c63aab4c0abf05402f9a04 (patch) | |
tree | cc76e44356eb4c12dc3268c3615aeac8d09e9cb8 /lib/rdoc/store.rb | |
parent | 3d07754ee2c707343f79321b0fd358af3154709f (diff) |
[ruby/rdoc] fix: C variables should never show up in Ancestors tree
(https://github.com/ruby/rdoc/pull/1217)
If a NormalClass's superclass is a C enclosure, then update the
superclass to point to the RDoc::NormalClass.
This is done in a single pass after all files have been parsed.
Fixes https://github.com/ruby/rdoc/pull/1205.
https://github.com/ruby/rdoc/commit/1ecd9581b1
Diffstat (limited to 'lib/rdoc/store.rb')
-rw-r--r-- | lib/rdoc/store.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/rdoc/store.rb b/lib/rdoc/store.rb index cd27d47dd1..e85bc9d33a 100644 --- a/lib/rdoc/store.rb +++ b/lib/rdoc/store.rb @@ -198,6 +198,18 @@ class RDoc::Store end ## + # Make sure any references to C variable names are resolved to the corresponding class. + # + + def resolve_c_superclasses + @classes_hash.each_value do |klass| + if klass.superclass.is_a?(String) && (candidate = find_c_enclosure(klass.superclass)) + klass.superclass = candidate + end + end + end + + ## # Sets the parser of +absolute_name+, unless it from a source code file. def update_parser_of_file(absolute_name, parser) |