Skip to content

Conversation

DustinCampbell
Copy link
Member

@DustinCampbell DustinCampbell commented Aug 21, 2025

This is a bit of a rethink of #12024

This pull request cleans up and reduces allocations in declaration-level intermediate nodes: NamespaceDeclarationIntermediateNode, ClassDeclarationIntermediateNode, MethodDeclarationIntermediateNode, FieldDeclarationIntermediateNode, PropertyDeclarationIntermediateNode, and related types. In particular, various collection properties are no longer types as IList<T> and pre-assigned with a List<T> instance. Instead, these properties now return ImmutableArray<T>.


CI Build: https://dev.azure.com/dnceng/internal/_build/results?buildId=2777478&view=results
Test Insertion: https://dev.azure.com/devdiv/DevDiv/_git/VS/pullrequest/663973
Toolset Run: https://dev.azure.com/dnceng/internal/_build/results?buildId=2777479&view=results

- Enable nullable
- Make Children property lazy.
- Remove unnecessary argument-null checks
- Rename Content property to Name
- Enable nullable
- Make Children property lazy.
- Remove unnecessary argument-null checks
- Rename ClassName property to Name
- Update Modifiers property to return ImmutableArray<string>
- Update Interfaces property to return ImmutableArray<IntermediateToken>
- Update TypeParameters property to return ImmutableArray<TypeParameter>
- Move auto-properties to top of class
- Make most properties read-only
- Use pattern matching to avoid accessing SourceSpan?.Value multiple times
- Enable nullable
- Rename ParameterName property to Name
- Update Name property to return IntermediateToken.
- Update Constraints property to return IntermediateToken.
- Remove ParameterNameSource property
- Remove ConstraintsSource property
- Add constructors
- Make properties read-only
- Enable nullable
- Remove unnecessary argument-null checks
- Rename FieldName property to Name
- Rename FieldType property to Type
- Update Modifiers property to return ImmutableArray<string>
- Update SuppressWarnings property to return ImmutableArray<string>
- Make all properties init-only
- Make Name and Type properties required
- Enable nullable
- Remove unnecessary argument-null checks
- Rename PropertyName property to Name
- Rename PropertyType property to Type
- Rename PropertyExpression property to ExpressionBody
- Update Modifiers property to return ImmutableArray<string>
- Make all properties init-only
- Make Name, Type and ExpressionBody properties required
- Enable nullable
- Remove unnecessary argument-null checks
- Rename MethodName property to Name
- Update Modifiers property to return ImmutableArray<string>
- Update Parameters property to return ImmutableArray<MethodParameter>
- Enable nullable
- Rename ParameterName property to Name
- Rename TypeName property to Type
- Update Modifiers property to return ImmutableArray<string>
- Add constructor
- Make properties read-only
Copy link
Contributor

@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
Member Author

@chsienki, PTAL

@DustinCampbell DustinCampbell merged commit a118983 into dotnet:main Aug 27, 2025
11 checks passed
@DustinCampbell DustinCampbell deleted the decl-intermediate-nodes branch August 27, 2025 12:40
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Aug 27, 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.

4 participants