Open CoolCoderSuper opened 1 month ago
Why does this need to be public? As opposed to just fixing GetModifiers to include this data internally to ensure that WithModifiers doesn't remove the modifier?
I suppose it wouldn't have to be but this would allow new generation to have the modifier applied.
But maybe that doesn't matter since you would still have to deal with yield return
vs Yield
.
@CyrusNajmabadi just so I understand, your proposal would be the same just internal rather than public?
Background and Motivation
For quick reference the file can be found here The purpose of this api is to solve this issue in the make member static analyzer.
C# does not have the explicit Iterator api and when using the SyntaxGenerator the modifier is dropped. The type already has features that are language specific (ie IsUnsafe) so I would see no harm in supporting this as well.
This would bring the option for generators to create iterator methods closer to reality (not necessarily important).
Proposed API
This would also include the corresponding WithIterator() api.
Usage Examples
Alternative Designs
Not having the API and having language specific code in the analyzer.
Risks
Possible confusion since it only exists in VB.