Skip to content

Create specific syntax node type for using directives#12753

Merged
davidwengier merged 7 commits intodotnet:mainfrom
davidwengier:UsingDirectiveSyntax
Feb 10, 2026
Merged

Create specific syntax node type for using directives#12753
davidwengier merged 7 commits intodotnet:mainfrom
davidwengier:UsingDirectiveSyntax

Conversation

@davidwengier
Copy link
Copy Markdown
Member

@davidwengier davidwengier commented Feb 6, 2026

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 RazorDirectiveSyntax node, 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 IsUnused property, 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.

@davidwengier davidwengier requested a review from a team as a code owner February 6, 2026 00:53
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.

3 participants