Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
51638c7f
R
roslyn
项目概览
lwm1986
/
roslyn
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
roslyn
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
51638c7f
编写于
12月 20, 2018
作者:
M
Manish Vasani
提交者:
GitHub
12月 20, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #31940 from mavasani/NamespaceAndDescendants
Rename new suppress message attribute scope
上级
1d7a0bb9
96f96ba3
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
14 addition
and
14 deletion
+14
-14
src/Compilers/Core/Portable/DiagnosticAnalyzer/SuppressMessageAttributeState.cs
...table/DiagnosticAnalyzer/SuppressMessageAttributeState.cs
+4
-4
src/Test/Utilities/Portable/Diagnostics/SuppressMessageAttributeTests.cs
...ies/Portable/Diagnostics/SuppressMessageAttributeTests.cs
+10
-10
未找到文件。
src/Compilers/Core/Portable/DiagnosticAnalyzer/SuppressMessageAttributeState.cs
浏览文件 @
51638c7f
...
...
@@ -21,7 +21,7 @@ internal partial class SuppressMessageAttributeState
{
"resource"
,
TargetScope
.
Resource
},
{
"type"
,
TargetScope
.
Type
},
{
"member"
,
TargetScope
.
Member
},
{
"namespaceand
children"
,
TargetScope
.
NamespaceAndChildren
}
{
"namespaceand
descendants"
,
TargetScope
.
NamespaceAndDescendants
}
};
private
static
bool
TryGetTargetScope
(
SuppressMessageInfo
info
,
out
TargetScope
scope
)
...
...
@@ -82,7 +82,7 @@ public bool HasGlobalSymbolSuppression(ISymbol symbol, string id, bool isImmedia
// In other words, only apply suppression to the immediately containing namespace declaration and not to its children or parents.
return
isImmediatelyContainingSymbol
;
case
TargetScope
.
NamespaceAnd
Children
:
case
TargetScope
.
NamespaceAnd
Descendants
:
return
true
;
}
}
...
...
@@ -332,7 +332,7 @@ internal static IEnumerable<ISymbol> ResolveTargetSymbols(Compilation compilatio
return
results
;
}
case
TargetScope
.
NamespaceAnd
Children
:
case
TargetScope
.
NamespaceAnd
Descendants
:
return
ResolveTargetSymbols
(
compilation
,
target
,
TargetScope
.
Namespace
);
default
:
...
...
@@ -383,7 +383,7 @@ internal enum TargetScope
Resource
,
Type
,
Member
,
NamespaceAnd
Children
NamespaceAnd
Descendants
}
}
}
src/Test/Utilities/Portable/Diagnostics/SuppressMessageAttributeTests.cs
浏览文件 @
51638c7f
...
...
@@ -111,13 +111,13 @@ namespace N4
}
[
Fact
,
WorkItem
(
486
,
"https://github.com/dotnet/roslyn/issues/486"
)]
public
async
Task
GlobalSuppressionOnNamespaces_NamespaceAnd
Children
()
public
async
Task
GlobalSuppressionOnNamespaces_NamespaceAnd
Descendants
()
{
await
VerifyCSharpAsync
(
@"
using System.Diagnostics.CodeAnalysis;
[assembly: SuppressMessage(""Test"", ""Declaration"", Scope=""NamespaceAnd
Children
"", Target=""N.N1"")]
[module: SuppressMessage(""Test"", ""Declaration"", Scope=""namespaceand
children
"", Target=""N4"")]
[assembly: SuppressMessage(""Test"", ""Declaration"", Scope=""NamespaceAnd
Descendants
"", Target=""N.N1"")]
[module: SuppressMessage(""Test"", ""Declaration"", Scope=""namespaceand
descendants
"", Target=""N4"")]
namespace N
{
...
...
@@ -145,13 +145,13 @@ namespace N.N1.N6.N7
}
[
Fact
,
WorkItem
(
486
,
"https://github.com/dotnet/roslyn/issues/486"
)]
public
async
Task
GlobalSuppressionOnTypesAndNamespaces_NamespaceAnd
Children
()
public
async
Task
GlobalSuppressionOnTypesAndNamespaces_NamespaceAnd
Descendants
()
{
await
VerifyCSharpAsync
(
@"
using System.Diagnostics.CodeAnalysis;
[assembly: SuppressMessage(""Test"", ""Declaration"", Scope=""NamespaceAnd
Children
"", Target=""N.N1.N2"")]
[module: SuppressMessage(""Test"", ""Declaration"", Scope=""NamespaceAnd
Children
"", Target=""N4"")]
[assembly: SuppressMessage(""Test"", ""Declaration"", Scope=""NamespaceAnd
Descendants
"", Target=""N.N1.N2"")]
[module: SuppressMessage(""Test"", ""Declaration"", Scope=""NamespaceAnd
Descendants
"", Target=""N4"")]
[module: SuppressMessage(""Test"", ""Declaration"", Scope=""Type"", Target=""C2"")]
namespace N
...
...
@@ -449,7 +449,7 @@ class C {}
public
async
Task
SuppressSyntaxDiagnosticsOnNamespaceAndChildDeclarationCSharp
()
{
await
VerifyTokenDiagnosticsCSharpAsync
(
@"
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage(""Test"", ""Token"", Scope=""NamespaceAnd
Children
"", Target=""A.B"")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage(""Test"", ""Token"", Scope=""NamespaceAnd
Descendants
"", Target=""A.B"")]
namespace A
[|{
namespace B
...
...
@@ -483,10 +483,10 @@ End Namespace
}
[
Fact
,
WorkItem
(
486
,
"https://github.com/dotnet/roslyn/issues/486"
)]
public
async
Task
SuppressSyntaxDiagnosticsOnNamespaceAnd
Children
DeclarationBasic
()
public
async
Task
SuppressSyntaxDiagnosticsOnNamespaceAnd
Descendants
DeclarationBasic
()
{
await
VerifyTokenDiagnosticsBasicAsync
(
@"
<assembly: System.Diagnostics.CodeAnalysis.SuppressMessage(""Test"", ""Token"", Scope:=""NamespaceAnd
Children
"", Target:=""A.B"")>
<assembly: System.Diagnostics.CodeAnalysis.SuppressMessage(""Test"", ""Token"", Scope:=""NamespaceAnd
Descendants
"", Target:=""A.B"")>
Namespace [|A
Namespace B
Class C
...
...
@@ -500,7 +500,7 @@ End Namespace
[
Theory
,
WorkItem
(
486
,
"https://github.com/dotnet/roslyn/issues/486"
)]
[
InlineData
(
"Namespace"
)]
[
InlineData
(
"NamespaceAnd
Children
"
)]
[
InlineData
(
"NamespaceAnd
Descendants
"
)]
public
async
Task
DontSuppressSyntaxDiagnosticsInRootNamespaceBasic
(
string
scope
)
{
await
VerifyBasicAsync
(
$@"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录