Split the MarshalAsParser into two classes #93038
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
One class will handle the raw parsing of the MarshalAs attribute.
The other class handles resolving a MarshalAs attribute into the custom marshaller type that will provide the marshalling based on our generator's rules.
This split makes it easier for other generator models to reuse our parsing logic without having to also reuse our custom marshaller resolution logic. In particular, a hypothetical IDispatch-focused generator would want to marshal all values into
VARIANTvalues, so they may want to reuse the marshaller attribute parsing logic, but not the custom marshallers directly.