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

Remove unused diagnostic methods. #30539

Merged
merged 1 commit into from Oct 16, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -108,49 +108,8 @@ public bool IsDiagnosticSuppressed(Diagnostic diagnostic, out AttributeData supp
return false;
}

private bool IsDiagnosticSuppressed(Diagnostic diagnostic, out SuppressMessageInfo info, ISymbol symbolOpt = null)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there are no callers of this method that pass in "symbolOpt". So symbolOpt is always null. So nothing ever called IsDiagnosticSuppressed(diagnostic.Id, symbolOpt, out info).

{
if (symbolOpt != null && IsDiagnosticSuppressed(diagnostic.Id, symbolOpt, out info))
{
return true;
}

return IsDiagnosticSuppressed(diagnostic.Id, diagnostic.Location, out info);
}

private bool IsDiagnosticSuppressed(string id, ISymbol symbol, out SuppressMessageInfo info)
{
Debug.Assert(id != null);
Debug.Assert(symbol != null);

if (symbol.Kind == SymbolKind.Namespace)
{
// Suppressions associated with namespace symbols only apply to namespace declarations themselves
// and any syntax nodes immediately contained therein, not to nodes attached to any other symbols.
// Diagnostics those nodes will be filtered by location, not by associated symbol.
info = default(SuppressMessageInfo);
return false;
}

if (symbol.Kind == SymbolKind.Method)
{
var associated = ((IMethodSymbol)symbol).AssociatedSymbol;
if (associated != null &&
(IsDiagnosticLocallySuppressed(id, associated, out info) || IsDiagnosticGloballySuppressed(id, associated, out info)))
{
return true;
}
}

if (IsDiagnosticLocallySuppressed(id, symbol, out info) || IsDiagnosticGloballySuppressed(id, symbol, out info))
{
return true;
}

// Check for suppression on parent symbol
var parent = symbol.ContainingSymbol;
return parent != null && IsDiagnosticSuppressed(id, parent, out info);
}
private bool IsDiagnosticSuppressed(Diagnostic diagnostic, out SuppressMessageInfo info)
=> IsDiagnosticSuppressed(diagnostic.Id, diagnostic.Location, out info);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is just the original method, with the optional symbol (that was never used) removed.


private bool IsDiagnosticSuppressed(string id, Location location, out SuppressMessageInfo info)
{
Expand Down