Skip to content

Port ComClassGenerator to string writing instead of constructing syntax nodes#125527

Merged
jkoritzinsky merged 4 commits intodotnet:mainfrom
DoctorKrolic:com-class-generator-string-writing
Mar 16, 2026
Merged

Port ComClassGenerator to string writing instead of constructing syntax nodes#125527
jkoritzinsky merged 4 commits intodotnet:mainfrom
DoctorKrolic:com-class-generator-string-writing

Conversation

@DoctorKrolic
Copy link
Contributor

The easiest part of #95882

@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Mar 13, 2026
@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @dotnet/interop-contrib
See info in area-owners.md if you want to be subscribed.

Copy link
Member

@jkoritzinsky jkoritzinsky left a comment

Choose a reason for hiding this comment

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

Looks pretty good! If you're taking a stab at this work, there's one more piece I'd like to figure out. Can we introduce a new type that doesn't store syntax nodes to handle the containing syntax (such as a type that, given syntax, computes a prefix, indent value to use for contents, and suffix)?

That way we could get to a point where we aren't passing syntax around between steps, as that's one of the main reasons we want to move to strings.

@DoctorKrolic
Copy link
Contributor Author

Can we introduce a new type that doesn't store syntax nodes to handle the containing syntax

I would like to revisit pipeline models after we port all generators to strings. This way I can focus on the "back side" of the pipeline without diving into the data collection part of it. Yes, this generator is the simplest of them, but for others trying to tweak the front and the back side at the same time might be challenging. For the transition period syntax is still a good common denominator since it is both siutable for node construction and string writing due to convinience of To[Full]String(). Porting to strings without changing the models still has value in simplification and reduction of all intermediate node allocations

@jkoritzinsky
Copy link
Member

I think that's reasonable.

@jkoritzinsky jkoritzinsky enabled auto-merge (squash) March 16, 2026 19:56
@jkoritzinsky
Copy link
Member

/ba-g ios failures unrelated

@jkoritzinsky jkoritzinsky merged commit 902b10f into dotnet:main Mar 16, 2026
98 of 102 checks passed
@DoctorKrolic DoctorKrolic deleted the com-class-generator-string-writing branch March 17, 2026 05:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-System.Runtime.InteropServices community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants