Skip to content

Commit

Permalink
Fix SA1312 treating fields as local variables
Browse files Browse the repository at this point in the history
Fixes #1328
  • Loading branch information
sharwell committed Aug 30, 2015
1 parent 9b6cc3a commit 5348145
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ private static void HandleCompilationStart(CompilationStartAnalysisContext conte
private static void HandleVariableDeclarationSyntax(SyntaxNodeAnalysisContext context)
{
VariableDeclarationSyntax syntax = (VariableDeclarationSyntax)context.Node;
if (syntax.Parent.IsKind(SyntaxKind.FieldDeclaration))
{
// This diagnostic is only for local variables.
return;
}

if (NamedTypeHelpers.IsContainedInNativeMethodsClass(syntax))
{
return;
Expand Down

0 comments on commit 5348145

Please sign in to comment.