Revert "[ruby/rdoc] fix: C variables should never show up in Ancestors tree"
This reverts commit 2923f42ed7622f6310c63aab4c0abf05402f9a04. https://github.com/ruby/actions/actions/runs/12108034481/job/33755653615#step:23:1031 ``` /home/runner/work/actions/actions/snapshot-master/lib/rdoc/code_object.rb:322:in 'RDoc::CodeObject#parent': undefined method 'find_class_or_module' for nil (NoMethodError) from /home/runner/work/actions/actions/snapshot-master/lib/rdoc/code_object/class_module.rb:342:in 'RDoc::ClassModule#marshal_dump' from /home/runner/work/actions/actions/snapshot-master/lib/rdoc/store.rb:878:in 'Marshal.dump' from /home/runner/work/actions/actions/snapshot-master/lib/rdoc/store.rb:878:in 'block in RDoc::Store#save_class' from /home/runner/work/actions/actions/snapshot-master/lib/rdoc/store.rb:877:in 'IO.open' from /home/runner/work/actions/actions/snapshot-master/lib/rdoc/store.rb:877:in 'RDoc::Store#save_class' from /home/runner/work/actions/actions/snapshot-master/lib/rdoc/store.rb:763:in 'block in RDoc::Store#save' from /home/runner/work/actions/actions/snapshot-master/lib/rdoc/store.rb:762:in 'Array#each' from /home/runner/work/actions/actions/snapshot-master/lib/rdoc/store.rb:762:in 'RDoc::Store#save' from /home/runner/work/actions/actions/snapshot-master/lib/rdoc/generator/ri.rb:27:in 'RDoc::Generator::RI#generate' from /home/runner/work/actions/actions/snapshot-master/lib/rdoc/rdoc.rb:528:in 'block in RDoc::RDoc#generate' from /home/runner/work/actions/actions/snapshot-master/lib/rdoc/rdoc.rb:522:in 'Dir.chdir' from /home/runner/work/actions/actions/snapshot-master/lib/rdoc/rdoc.rb:522:in 'RDoc::RDoc#generate' from /home/runner/work/actions/actions/snapshot-master/lib/rdoc/rdoc.rb:501:in 'RDoc::RDoc#document' from ./tool/rdoc-srcdir:27:in '<main>' ```
This commit is contained in:
parent
1df52e097b
commit
0fe82ae087
@ -415,8 +415,6 @@ The internal error was:
|
||||
parse_file filename
|
||||
end.compact
|
||||
|
||||
@store.resolve_c_superclasses
|
||||
|
||||
@stats.done_adding
|
||||
@options = original_options
|
||||
|
||||
|
@ -197,18 +197,6 @@ class RDoc::Store
|
||||
top_level
|
||||
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.
|
||||
|
||||
|
@ -281,26 +281,6 @@ class TestRDocStore < XrefTestCase
|
||||
assert_nil @s.find_c_enclosure('cObject')
|
||||
end
|
||||
|
||||
def test_resolve_c_superclasses
|
||||
# first parse a child that references an unknown parent
|
||||
c_file1 = @s.add_file 'ext1.c'
|
||||
c_file1.add_class RDoc::NormalClass, 'Child', 'cExternParent'
|
||||
|
||||
# then parse the parent and register the C variable name as a C enclosure
|
||||
c_file2 = @s.add_file 'ext2.c'
|
||||
parent = c_file2.add_class RDoc::NormalClass, 'Parent', 'rb_cObject'
|
||||
|
||||
@s.add_c_enclosure('cExternParent', parent)
|
||||
|
||||
# at this point, the child's superclass is still the name of the C variable
|
||||
assert_equal("cExternParent", @s.classes_hash['Child'].superclass)
|
||||
|
||||
@s.resolve_c_superclasses
|
||||
|
||||
# now the ancestor tree correctly references the NormalClass objects
|
||||
assert_equal(parent, @s.classes_hash['Child'].superclass)
|
||||
end
|
||||
|
||||
def test_find_class_named
|
||||
assert_equal @c1, @store.find_class_named('C1')
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user