提交 83b90dbe 编写于 作者: M Manish Vasani

Address feedback

上级 677d520a
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.Immutable;
......@@ -12,9 +13,9 @@ namespace Microsoft.CodeAnalysis.Diagnostics
{
internal partial class SuppressMessageAttributeState
{
private static readonly SmallDictionary<string, TargetScope> s_suppressMessageScopeTypes = new SmallDictionary<string, TargetScope>()
private static readonly SmallDictionary<string, TargetScope> s_suppressMessageScopeTypes = new SmallDictionary<string, TargetScope>(StringComparer.OrdinalIgnoreCase)
{
{ null, TargetScope.None },
{ string.Empty, TargetScope.None },
{ "module", TargetScope.Module },
{ "namespace", TargetScope.Namespace },
{ "resource", TargetScope.Resource },
......@@ -24,10 +25,7 @@ internal partial class SuppressMessageAttributeState
};
private static bool TryGetTargetScope(SuppressMessageInfo info, out TargetScope scope)
{
string scopeString = info.Scope != null ? info.Scope.ToLowerInvariant() : null;
return s_suppressMessageScopeTypes.TryGetValue(scopeString, out scope);
}
=> s_suppressMessageScopeTypes.TryGetValue(info.Scope ?? string.Empty, out scope);
private readonly Compilation _compilation;
private GlobalSuppressions _lazyGlobalSuppressions;
......@@ -170,7 +168,10 @@ private bool IsDiagnosticSuppressed(string id, Location location, out SuppressMe
{
return true;
}
}
if (!declaredSymbols.IsEmpty)
{
inImmediatelyContainingSymbol = false;
}
}
......
......@@ -117,7 +117,7 @@ public async Task GlobalSuppressionOnNamespaces_NamespaceAndChildren()
using System.Diagnostics.CodeAnalysis;
[assembly: SuppressMessage(""Test"", ""Declaration"", Scope=""NamespaceAndChildren"", Target=""N.N1"")]
[module: SuppressMessage(""Test"", ""Declaration"", Scope=""NamespaceAndChildren"", Target=""N4"")]
[module: SuppressMessage(""Test"", ""Declaration"", Scope=""namespaceandchildren"", Target=""N4"")]
namespace N
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册