-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Polyfill the incremental generator ForAttributeWithMetadataName from roslyn (for JsonGenerator). #71653
Conversation
…roslyn (for JsonGenerator).
Tagging subscribers to this area: @dotnet/area-system-text-json, @gregsdennis Issue DetailsFollowup to #70911
|
@@ -550,38 +551,6 @@ private static bool TryGetClassDeclarationList(INamedTypeSymbol typeSymbol, [Not | |||
return typeGenerationSpec; | |||
} | |||
|
|||
internal static bool IsSyntaxTargetForGeneration(SyntaxNode node) => node is ClassDeclarationSyntax { AttributeLists.Count: > 0, BaseList.Types.Count: > 0 }; |
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.
moved into the 3.11 source as that's the only place this is used now.
|
||
if (fullName == JsonSerializableAttributeFullName) | ||
{ | ||
return classDeclarationSyntax; |
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.
note: Teh only check we did was that hte fully qualified name is what we want. that's exactly what roslyn now does, so we need no additional semantic checks once we move to the roslyn api.
_pos--; | ||
return _span[_pos]; | ||
} | ||
} |
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.
same comment as: https://github.com/dotnet/runtime/pull/71651/files#r914021221
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.
Not sure I understand the purpose of this file. If it's a dependency for the added Roslyn helpers, why can't it just live inside $CommonPath
?
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.
It def can, and i've made that change in #71652. I'll port that over to this one.
cc @eiriktsarpalis @layomia @krwq @ericstj PTAL. For context, @CyrusNajmabadi is helping us add a much more performant way for source generators that depend on Attributes to run, and with these PRs he is onboarding generators one-by-one. Since you are the owners of the Json Source generator, do you mind taking a look at the changes and make sure they makes sense? |
src/libraries/System.Text.Json/src/System/Collections/Generic/ValueListBuilder.Pop.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.
LGTM other than a couple of comments.
src/libraries/System.Text.Json/gen/System.Text.Json.SourceGeneration.Roslyn4.0.csproj
Outdated
Show resolved
Hide resolved
…ration.Roslyn4.0.csproj
Related to #68353. |
Followup to #70911