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

Polyfill the incremental generator ForAttributeWithMetadataName from roslyn (for LoggingGenerator). #71651

Merged
merged 6 commits into from
Jul 7, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Simplify
  • Loading branch information
CyrusNajmabadi committed Jul 5, 2022
commit 32eb2f870fb4382c703ba7926cec139fab3774a6
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ public Parser(Compilation compilation, Action<Diagnostic> reportDiagnostic, Canc
_reportDiagnostic = reportDiagnostic;
}

internal static bool IsSyntaxTargetForGeneration(SyntaxNode node) =>
node is MethodDeclarationSyntax m && m.AttributeLists.Count > 0;

/// <summary>
/// Gets the set of logging classes containing methods to output.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ internal static ISyntaxContextReceiver Create()

public void OnVisitSyntaxNode(GeneratorSyntaxContext context)
{
if (Parser.IsSyntaxTargetForGeneration(context.Node))
if (IsSyntaxTargetForGeneration(context.Node))
{
ClassDeclarationSyntax classSyntax = GetSemanticTargetForGeneration(context);
if (classSyntax != null)
Expand All @@ -59,7 +59,10 @@ public void OnVisitSyntaxNode(GeneratorSyntaxContext context)
}
}

internal static ClassDeclarationSyntax? GetSemanticTargetForGeneration(GeneratorSyntaxContext context)
private static bool IsSyntaxTargetForGeneration(SyntaxNode node) =>
node is MethodDeclarationSyntax m && m.AttributeLists.Count > 0;

private static ClassDeclarationSyntax? GetSemanticTargetForGeneration(GeneratorSyntaxContext context)
{
var methodDeclarationSyntax = (MethodDeclarationSyntax)context.Node;

Expand Down