Skip to content

Commit 0fe82ae

Browse files
committed
Revert "[ruby/rdoc] fix: C variables should never show up in Ancestors tree"
This reverts commit 2923f42. 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>' ```
1 parent 1df52e0 commit 0fe82ae

File tree

3 files changed

+0
-34
lines changed

3 files changed

+0
-34
lines changed

lib/rdoc/rdoc.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -415,8 +415,6 @@ def parse_files files
415415
parse_file filename
416416
end.compact
417417

418-
@store.resolve_c_superclasses
419-
420418
@stats.done_adding
421419
@options = original_options
422420

lib/rdoc/store.rb

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -197,18 +197,6 @@ def add_file absolute_name, relative_name: absolute_name, parser: nil
197197
top_level
198198
end
199199

200-
##
201-
# Make sure any references to C variable names are resolved to the corresponding class.
202-
#
203-
204-
def resolve_c_superclasses
205-
@classes_hash.each_value do |klass|
206-
if klass.superclass.is_a?(String) && (candidate = find_c_enclosure(klass.superclass))
207-
klass.superclass = candidate
208-
end
209-
end
210-
end
211-
212200
##
213201
# Sets the parser of +absolute_name+, unless it from a source code file.
214202

test/rdoc/test_rdoc_store.rb

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -281,26 +281,6 @@ def test_find_c_enclosure_from_cache_legacy
281281
assert_nil @s.find_c_enclosure('cObject')
282282
end
283283

284-
def test_resolve_c_superclasses
285-
# first parse a child that references an unknown parent
286-
c_file1 = @s.add_file 'ext1.c'
287-
c_file1.add_class RDoc::NormalClass, 'Child', 'cExternParent'
288-
289-
# then parse the parent and register the C variable name as a C enclosure
290-
c_file2 = @s.add_file 'ext2.c'
291-
parent = c_file2.add_class RDoc::NormalClass, 'Parent', 'rb_cObject'
292-
293-
@s.add_c_enclosure('cExternParent', parent)
294-
295-
# at this point, the child's superclass is still the name of the C variable
296-
assert_equal("cExternParent", @s.classes_hash['Child'].superclass)
297-
298-
@s.resolve_c_superclasses
299-
300-
# now the ancestor tree correctly references the NormalClass objects
301-
assert_equal(parent, @s.classes_hash['Child'].superclass)
302-
end
303-
304284
def test_find_class_named
305285
assert_equal @c1, @store.find_class_named('C1')
306286

0 commit comments

Comments
 (0)