Skip to content

Compiler: Small bits of clean up#12200

Merged
DustinCampbell merged 9 commits intodotnet:mainfrom
DustinCampbell:some-clean-up
Sep 17, 2025
Merged

Compiler: Small bits of clean up#12200
DustinCampbell merged 9 commits intodotnet:mainfrom
DustinCampbell:some-clean-up

Conversation

@DustinCampbell
Copy link
Copy Markdown
Member

This is just a small amount of clean up around a few intermediate nodes.

- Enable nullability
- Remove unnecessary argument-null checks.
- Declare constant values as consts
- Avoid computed properties that allocate new strings
- Add method for setting ComponentCaptureTypeName
- Simplify logic in ComponentGenericTypePass that updates the ComponentCaptureTypeName.
- IntermedateToken property can't ever be null. Fix usages that use a null-conditional operator.
- Mark as sealed
- Use pattern matching to simplify DetermineIdentifierToken.
- Update RewriteUsage to actually rewrite.
- Remove unnecessary argument-null checks
- Declare constant values as consts
- Don't declare unused variable for using statements
- Use string.Build(...) rather than interpolated string
- Enable nullability
- Remove unnecessary argument-null checks.
- KeyValueToken property can't ever be null. Fix usages that use a null-conditional operator.
- Remove unnecessary argument-null checks
- Mark as sealed
- Use pattern matching to simplify DetermineIdentifierToken.
- Update RewriteUsage to actually rewrite.
- Enable nullability
- Remove unnecessary argument-null checks.
- Mark as sealed
- Update RewriteUsage to actually rewrite.
- Remove unnecessary argument-null checks.
- Call CodeWriter.Write(...) once using interpolated string handler.
- Use CollectDescendantNodes to avoid allocating array.
@DustinCampbell DustinCampbell requested a review from a team as a code owner September 9, 2025 00:25
@DustinCampbell DustinCampbell requested review from a team, ToddGrun and chsienki September 9, 2025 00:26
@ToddGrun
Copy link
Copy Markdown

ToddGrun commented Sep 9, 2025

    WriteCSharpTokens(context, GetCSharpTokens(node));

Can the other callers to this also be modified?


Refers to: src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Components/ComponentRuntimeNodeWriter.cs:939 in 4a20f0f. [](commit_id = 4a20f0f, deletion_comment = True)

Copy link
Copy Markdown

@ToddGrun ToddGrun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@DustinCampbell
Copy link
Copy Markdown
Member Author

    WriteCSharpTokens(context, GetCSharpTokens(node));

Can the other callers to this also be modified?

Refers to: src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Components/ComponentRuntimeNodeWriter.cs:939 in 4a20f0f. [](commit_id = 4a20f0f, deletion_comment = True)

For sure, but not in this PR. I want to do a full clean up of the node writers.

@DustinCampbell
Copy link
Copy Markdown
Member Author

@chsienki, PTAL

@DustinCampbell DustinCampbell merged commit 0bb710a into dotnet:main Sep 17, 2025
11 checks passed
@DustinCampbell DustinCampbell deleted the some-clean-up branch September 17, 2025 19:13
@dotnet-policy-service dotnet-policy-service Bot added this to the Next milestone Sep 17, 2025
@akhera99 akhera99 modified the milestones: Next, 18.0 P1, 18.0 P2 Sep 22, 2025
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.

5 participants