-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove ItemCollection from CodeRenderingContext (#10764)
Because of a dare from @333fred, I'm currently on a crusade to remove `ItemCollection` from the Razor Compiler completely. Previously, I removed `ItemCollection` from `TagHelperDescriptorProviderContext` (#10720). This time, I'm removing it from `CodeRenderingContext`. It turns out that every `CodeRenderingContext` greedily creates an `ItemCollection`, though there are only ever two things stored there: 1. A string to use for new lines in `CodeWriter`. 2. A string representing "suppress IDs", which is already specified in `RazorCodeGenerationOptions`. These two items were really present as a hook that compiler tests could set. However, it's much easier and less wasteful to elevate both items to `RazorCodeGenerationOptions` and make tests set the options directly. I made a few other refactorings as part of this change: - I merged several abstract base classes with their single default concrete type: - `CodeRenderingContext` and `DefaultCodeRenderingContext` - `RazorCSharpDocument` and `DefaultRazorCSharpDocument`, - `RazorCodeGenerationOptions` and `DefaultRazorCodeGenerationOptions` - `RazorCodeGenerationOptionsBuilder` and `DefaultRazorCodeGenerationOptionsBuilder`. - Reworked `RazorCodeGenerationOptions` and introduced `RazorCodeGenerationOptionsFlags` to track its boolean fields. - Cleaned up `RazorCSharpDocument` and unified its collections on `ImmutableArray<>` rather than `IReadOnlyList<>`. - Enabled nullability annotations for several types. - Used more pooled collections in `CodeRenderingContext`. Note: I was careful with my commit history, and it should be clean enough to review commit-by-commit if that's your preference.
- Loading branch information
Showing
60 changed files
with
1,538 additions
and
1,256 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.