-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Optimize the Regex source generator's handling of Compilation
objects.
#65431
Conversation
…rator. And remove a now-unused file.
Tagging subscribers to this area: @dotnet/area-system-text-regularexpressions Issue DetailsThis PR optimizes the Regex source generator's pipeline in a similar way to what was done in #64579. The The
|
Compilation
objects.
src/libraries/System.Text.RegularExpressions/gen/RegexGenerator.Parser.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @teo-tsirpanis, this looks like a nice improvement! I've written my thoughts on the attribute lookup change.
Will leave it to @stephentoub to decide, but maybe for this PR we should leave the old behavior using GetBestTypeByMetadataName
and consider being more permissive in a separate change.
d27320e
to
00ad4be
Compare
PR feedback was addressed; we still use |
src/libraries/System.Text.RegularExpressions/gen/RegexGenerator.Parser.cs
Show resolved
Hide resolved
src/libraries/System.Text.RegularExpressions/gen/RegexGenerator.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks.
This PR optimizes the Regex source generator's pipeline in a similar way to what was done in #64579.
The
Compilation
object was mostly removed from the pipeline, with its presence being restricted to anIncrementalValueProvider<bool>
that contains whether unsafe code is allowed, which is seamlessly combined to the main pipeline without needing a custom comparer.The
GetRegexTypeToEmit
method was merged with theGetSemanticTargetForGeneration
method and moved earlier in the pipeline, according to feedback from the linked PR.