Create specific syntax node type for using directives#12753
Merged
davidwengier merged 7 commits intodotnet:mainfrom Feb 10, 2026
Merged
Create specific syntax node type for using directives#12753davidwengier merged 7 commits intodotnet:mainfrom
davidwengier merged 7 commits intodotnet:mainfrom
Conversation
…simplifying a bunch of it
This has always annoyed that we had to cast this, so thought I'd twaek it while we're here.
chsienki
approved these changes
Feb 9, 2026
This was referenced Feb 10, 2026
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.
As part of #8548 we're going to need to store a flag on using directive nodes in the compiler to note which directives contribute to component binding. That quickly runs into a problem of there being nowhere to store these on the
RazorDirectiveSyntaxnode, and it wouldn't make sense to add them, since that node represents any of a number of directives that it doesn't make sense to be "unused".So as a first step, I thought we should have a specific syntax node type for using directive nodes. In future we can add an
IsUnusedproperty, but for now this just allows a bit of code cleanup in callers. I also took advantage of being in the area to add a helper property for the directive body, because it's always annoyed me that we have to cast that.I think in an ideal world we'd have specific node types for every individual directive, but that seems out of scope for this PR. Happy to add it if reviewers think it won't make their lives too hard.