-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Polyfill the incremental generator ForAttributeWithMetadataName from roslyn. #70911
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
Changes from 1 commit
6e03dca
539b248
e8f0a8e
1c0fbf2
b533f26
c1a76b1
2ef0717
1f35a7e
f5d8137
be4ef0f
2babd86
1cdc428
cfce553
fd9a27e
e2613b6
a0e9d88
91672fe
86de769
cc933a2
8a5a8d0
4eb00d1
59cdea7
e7a1f3e
20d62a2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,6 +16,7 @@ | |
| using Microsoft.CodeAnalysis.CSharp; | ||
| using Microsoft.CodeAnalysis.CSharp.Syntax; | ||
| using Microsoft.CodeAnalysis.Text; | ||
| using Microsoft.CodeAnalysis.DotnetRuntime.Extensions; | ||
|
|
||
| [assembly: System.Resources.NeutralResourcesLanguage("en-us")] | ||
|
|
||
|
|
@@ -51,7 +52,11 @@ public void Initialize(IncrementalGeneratorInitializationContext context) | |
| context.SyntaxProvider | ||
|
|
||
| // Find all MethodDeclarationSyntax nodes attributed with RegexGenerator and gather the required information. | ||
| .CreateSyntaxProvider(IsSyntaxTargetForGeneration, GetSemanticTargetForGeneration) | ||
| .ForAttributeWithMetadataName( | ||
| context, | ||
| RegexGeneratorAttributeName, | ||
| (n, c) => n is MethodDeclarationSyntax, | ||
CyrusNajmabadi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| GetSemanticTargetForGeneration) | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. in the future you can delete all the code i've added and this line will now work against the actual ForAttributeWithMetadataName extension we expose. teh only difference is you will also delete the
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lovely |
||
| .Where(static m => m is not null) | ||
|
|
||
| // Generate the RunnerFactory for each regex, if possible. This is where the bulk of the implementation occurs. | ||
|
|
||
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.
if i was only referencing a tiny part of the surface area of the copied code, i
ifdefedout the rest to keep teh intrusion minimal. i kept the code in case we may need to access more of it. this allows the code to stay close in sync with teh roslyn version.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.
Can we please add a comment above explaining this?