Make the override modifier a link to the overridden member#3769
Merged
Conversation
The decompiled view only offered navigation on member names; finding what an override actually overrides required opening the analyzer. Attaching a reference to the modifier token gives the same go-to-definition affordance Visual Studio has on 'override'. The reference resolves via InheritanceHelper.GetBaseMember, so it targets the nearest overridden member and degrades to plain text when the base member cannot be resolved. Assisted-by: Claude:claude-fable-5:Claude Code
2 tasks
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
Fixes #2035. Supersedes #3741.
In the decompiled view, the
overridemodifier is now emitted as a reference to the nearest overridden member (resolved viaInheritanceHelper.GetBaseMember), giving the same go-to-definition affordance Visual Studio has on the keyword. When the base member cannot be resolved, the modifier falls back to plain text.The reference is attached in
TextTokenWriter.WriteKeyword, next to the existingthis/baseconstructor-initializer references, and is guarded strictly: it requiresEntityDeclaration.ModifierRoleand reads the owning declaration from the top of the node stack (modifier tokens are written without a stack push, so the top of the stack is the declaration the modifier belongs to).Test plan
TextTokenWriterTestscover: method and property overrides link to the base member, a second-level override links to the nearest overridden member (not the root of the hierarchy), andvirtual/abstractmodifiers stay plain text. Written red first, green after the change.ILSpy.Tests, 827 tests) and theDecompiler.Tests.Outputnamespace pass locally on Linux; navigation verified manually in the app.🤖 Generated with Claude Code