Remove the unmatched constant alias queue - #1766
Conversation
|
🚀 Preview deployment available at: https://7f7a8602.rdoc-6cd.pages.dev (commit: 80583c3) |
There was a problem hiding this comment.
Pull request overview
This PR removes the previously-unused unmatched_constant_alias queue from RDoc::Store and deletes the related deferred-alias handling in RDoc::Context, based on the fact that current call paths never invoke add_module_alias with a nil source.
Changes:
- Removed
RDoc::Store#unmatched_constant_alias(reader and initialization). - Deleted deferred alias-resolution logic that depended on the store’s unmatched-alias queue.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| lib/rdoc/store.rb | Removes the unused unmatched-constant-alias queue from the store. |
| lib/rdoc/code_object/context.rb | Removes queue-driven deferred alias handling tied to unmatched_constant_alias. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # BasicObject = BlankSlate | ||
| return from if @store.find_class_or_module to_full_name |
The queue handled a module alias whose target was not yet in the store, to be replayed when the target appeared. No caller passes an unresolved target anymore: the Ruby parser only registers a module alias after finding the target, and has been doing so since the Ripper-based parser was removed. A constant alias whose target appears later is handled by Constant#is_alias_for_path and ClassModule#update_aliases at Store#complete time. The from_name parameter of Context#add_module_alias only fed the queue, so it is removed as well. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
603fa0f to
80583c3
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.
Suppressed comments (1)
lib/rdoc/code_object/context.rb:552
RDoc::Context#add_module_aliasis a documented (public) method, and this change reduces its arity from 4 to 3 args. Even though the repo’s call sites were updated, this is a breaking API change for any external callers.
Consider keeping backward compatibility by accepting both the new (from, to, file) form and the legacy (from, from_name, to, file) form (ignoring from_name), and add an explicit ArgumentError when from is nil to avoid a confusing NoMethodError on from.dup.
# Adds an alias from +from+ (a class or module) to the constant +to+ which
# was defined in +file+.
def add_module_alias(from, to, file)
return from if @done_documenting
unmatched_constant_aliasis not used anymore.Value was set in
add_module_alias(from, from_name, to, file)whenfromis nil, but all path that callsadd_module_aliasdoesn't passnilto it.