Skip to content

Make the override modifier a link to the overridden member#3769

Merged
siegfriedpammer merged 1 commit into
masterfrom
override-keyword-link
Jun 11, 2026
Merged

Make the override modifier a link to the overridden member#3769
siegfriedpammer merged 1 commit into
masterfrom
override-keyword-link

Conversation

@siegfriedpammer

Copy link
Copy Markdown
Member

Summary

Fixes #2035. Supersedes #3741.

In the decompiled view, the override modifier is now emitted as a reference to the nearest overridden member (resolved via InheritanceHelper.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 existing this/base constructor-initializer references, and is guarded strictly: it requires EntityDeclaration.ModifierRole and 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

  • New TextTokenWriterTests cover: 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), and virtual/abstract modifiers stay plain text. Written red first, green after the change.
  • Full headless UI suite (ILSpy.Tests, 827 tests) and the Decompiler.Tests.Output namespace pass locally on Linux; navigation verified manually in the app.

🤖 Generated with Claude Code

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
@siegfriedpammer siegfriedpammer merged commit 34c50c1 into master Jun 11, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"override" keyword should be a hyperlink

1 participant