Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move Regex source generator generated helper methods to a shared class #63502

Closed
stephentoub opened this issue Jan 7, 2022 · 2 comments · Fixed by #66432
Closed

Move Regex source generator generated helper methods to a shared class #63502

stephentoub opened this issue Jan 7, 2022 · 2 comments · Fixed by #66432

Comments

@stephentoub
Copy link
Member

Blocked on dotnet/csharplang#5529

Every generated regex today may potentially generate one or more helper methods, e.g. for pushing and popping from the stack, for evaluating a word character, etc. If there are multiple generated regexes in the same assembly, each of them ends up with their own copy of these functions. We would like to move them into an internal class all of the generated regexes can access, but that then makes them available as well to the rest of the assembly, and we don't want user code elsewhere in the assembly calling into these implementation details. Once C# provides a solution for this, e.g. a "file private" visibility, we should employ it to reduce the duplication.

(In the meantime, we could choose to rely on EditorBrowsableState.Never and name obfuscation and still share the functionality, but it's a risk.)

@ghost
Copy link

ghost commented Jan 7, 2022

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

Issue Details

Blocked on dotnet/csharplang#5529

Every generated regex today may potentially generate one or more helper methods, e.g. for pushing and popping from the stack, for evaluating a word character, etc. If there are multiple generated regexes in the same assembly, each of them ends up with their own copy of these functions. We would like to move them into an internal class all of the generated regexes can access, but that then makes them available as well to the rest of the assembly, and we don't want user code elsewhere in the assembly calling into these implementation details. Once C# provides a solution for this, e.g. a "file private" visibility, we should employ it to reduce the duplication.

(In the meantime, we could choose to rely on EditorBrowsableState.Never and name obfuscation and still share the functionality, but it's a risk.)

Author: stephentoub
Assignees: -
Labels:

area-System.Text.RegularExpressions

Milestone: 7.0.0

@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged New issue has not been triaged by the area owner label Jan 7, 2022
@stephentoub
Copy link
Member Author

cc: @jaredpar

@jeffschwMSFT jeffschwMSFT removed the untriaged New issue has not been triaged by the area owner label Jan 11, 2022
@stephentoub stephentoub self-assigned this Mar 9, 2022
@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Mar 10, 2022
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Mar 10, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Apr 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants