Fix :stopdoc: directive being undone for C-defined classes#1658
Open
Fix :stopdoc: directive being undone for C-defined classes#1658
Conversation
Collaborator
|
🚀 Preview deployment available at: https://ac9127d7.rdoc-6cd.pages.dev (commit: 2bce391) |
2 tasks
8269e21 to
ff2898f
Compare
After parsing, `parse_file` resets `done_documenting = false` on all classes in `top_level.classes_or_modules`. The `done_documenting=` setter unconditionally sets `document_self = !value`, which overrides the `document_self = false` state set by `:stopdoc:`. This became visible after `add_to_classes_or_modules` was added to the C parser's `handle_class_module`, causing C-defined classes to appear in `top_level.classes_or_modules` for the first time. Fix by tracking when `:stopdoc:` is explicitly used via a `@stopped_doc` flag. The `done_documenting=` setter skips the `document_self` override when this flag is set. The flag is: - Set only when the `:stopdoc:` directive is processed - Cleared by `:startdoc:` - NOT set by `suppress` (which calls `stop_doc` internally but should remain reversible via `done_documenting = false`)
ff2898f to
2bce391
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
parse_fileresetsdone_documenting = falseon all classes intop_level.classes_or_modulesdone_documenting=also sets@document_self = !value, this inadvertently resetsdocument_selftotruefor classes that had:stopdoc:applied during parsingadd_to_classes_or_moduleswas added to the C parser'shandle_class_module, which caused C-defined classes to appear intop_level.classes_or_modulesfor the first time:stopdoc:directives with a@stopped_docflag sodone_documenting=preserves the stopdoc stateReproduction
Run
rdoc -Cagainst a C extension that uses:stopdoc:around class definitions, such as io-console:These classes are intentionally wrapped in
/* :stopdoc: *///* :startdoc: */and should not appear in coverage.