Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
06890b67
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,发现更多精彩内容 >>
提交
06890b67
编写于
4月 27, 2015
作者:
M
Matt Warren
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Expose DocumentationCommentId as public API
上级
978ad190
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
122 addition
and
19 deletion
+122
-19
src/Compilers/Core/Portable/CodeAnalysis.csproj
src/Compilers/Core/Portable/CodeAnalysis.csproj
+1
-1
src/Compilers/Core/Portable/DiagnosticAnalyzer/SuppressMessageAttributeState.TargetSymbolResolver.cs
...zer/SuppressMessageAttributeState.TargetSymbolResolver.cs
+2
-2
src/Compilers/Core/Portable/DocumentationCommentId.cs
src/Compilers/Core/Portable/DocumentationCommentId.cs
+110
-13
src/Compilers/Core/Portable/PublicAPI.txt
src/Compilers/Core/Portable/PublicAPI.txt
+9
-0
src/Workspaces/Core/Portable/Workspaces.csproj
src/Workspaces/Core/Portable/Workspaces.csproj
+0
-3
未找到文件。
src/Compilers/Core/Portable/CodeAnalysis.csproj
浏览文件 @
06890b67
...
...
@@ -131,7 +131,7 @@
<Compile
Include=
"InternalImplementationOnlyAttribute.cs"
/>
<Compile
Include=
"InternalUtilities\AssemblyLocationLightUp.cs"
/>
<Compile
Include=
"Emit\EditAndContinueMethodDebugInformation.cs"
/>
<Compile
Include=
"
InternalUtilities\
DocumentationCommentId.cs"
/>
<Compile
Include=
"DocumentationCommentId.cs"
/>
<Compile
Include=
"Emit\EditAndContinue\SymbolMatcher.cs"
/>
<Compile
Include=
"InternalUtilities\FailFast.cs"
/>
<Compile
Include=
"InternalUtilities\FileStreamLightUp.cs"
/>
...
...
src/Compilers/Core/Portable/DiagnosticAnalyzer/SuppressMessageAttributeState.TargetSymbolResolver.cs
浏览文件 @
06890b67
...
...
@@ -65,8 +65,8 @@ public void Resolve(IList<ISymbol> results)
}
// Try to parse the name as declaration ID generated from symbol's documentation comment Id.
List
<
ISymbol
>
docIdResults
;
if
(
DocumentationCommentId
.
TryGetSymbolsForDeclarationId
(
RemovePrefix
(
_name
,
s_suppressionPrefix
),
_compilation
,
out
docIdResults
)
)
var
docIdResults
=
DocumentationCommentId
.
GetSymbolsForDeclarationId
(
RemovePrefix
(
_name
,
s_suppressionPrefix
),
_compilation
)
;
if
(
docIdResults
.
Count
>
0
)
{
foreach
(
var
result
in
docIdResults
)
{
...
...
src/Compilers/Core/Portable/
InternalUtilities/
DocumentationCommentId.cs
→
src/Compilers/Core/Portable/DocumentationCommentId.cs
浏览文件 @
06890b67
...
...
@@ -13,7 +13,7 @@ namespace Microsoft.CodeAnalysis
/// <summary>
/// APIs for constructing documentation comment id's, and finding symbols that match ids.
/// </summary>
internal
class
DocumentationCommentId
public
static
class
DocumentationCommentId
{
private
class
ListPool
<
T
>
:
ObjectPool
<
List
<
T
>>
{
...
...
@@ -43,6 +43,11 @@ public new void Free(List<T> list)
/// </summary>
public
static
string
CreateDeclarationId
(
ISymbol
symbol
)
{
if
(
symbol
==
null
)
{
throw
new
ArgumentNullException
(
nameof
(
symbol
));
}
var
builder
=
new
StringBuilder
();
var
generator
=
new
DeclarationGenerator
(
builder
);
generator
.
Visit
(
symbol
);
...
...
@@ -55,6 +60,11 @@ public static string CreateDeclarationId(ISymbol symbol)
/// </summary>
public
static
string
CreateReferenceId
(
ISymbol
symbol
)
{
if
(
symbol
==
null
)
{
throw
new
ArgumentNullException
(
nameof
(
symbol
));
}
if
(
symbol
is
INamespaceSymbol
)
{
return
CreateDeclarationId
(
symbol
);
...
...
@@ -69,19 +79,45 @@ public static string CreateReferenceId(ISymbol symbol)
/// <summary>
/// Gets all declaration symbols that match the declaration id string
/// </summary>
public
static
I
Enumerable
<
ISymbol
>
GetSymbolsForDeclarationId
(
string
id
,
Compilation
compilation
)
public
static
I
ReadOnlyList
<
ISymbol
>
GetSymbolsForDeclarationId
(
string
id
,
Compilation
compilation
)
{
List
<
ISymbol
>
results
;
TryGetSymbolsForDeclarationId
(
id
,
compilation
,
out
results
);
if
(
id
==
null
)
{
throw
new
ArgumentNullException
(
nameof
(
id
));
}
if
(
compilation
==
null
)
{
throw
new
ArgumentNullException
(
nameof
(
compilation
));
}
var
results
=
new
List
<
ISymbol
>();
TryGetSymbolsForDeclarationId
(
id
,
compilation
,
results
);
return
results
;
}
/// <summary>
/// Try get all declaration symbols that match the declaration id string
/// Try to get all the declaration symbols that match the declaration id string.
/// Returns true if atleast one symbol matches.
/// </summary>
public
static
bool
TryGetSymbolsForDeclarationId
(
string
id
,
Compilation
compilation
,
out
List
<
ISymbol
>
results
)
/// <remarks>This API is available for possible of reuse of results lists.</remarks>
public
static
bool
TryGetSymbolsForDeclarationId
(
string
id
,
Compilation
compilation
,
List
<
ISymbol
>
results
)
{
results
=
new
List
<
ISymbol
>();
if
(
id
==
null
)
{
throw
new
ArgumentNullException
(
nameof
(
id
));
}
if
(
compilation
==
null
)
{
throw
new
ArgumentNullException
(
nameof
(
compilation
));
}
if
(
results
==
null
)
{
throw
new
ArgumentNullException
(
nameof
(
results
));
}
return
Parser
.
ParseDeclaredSymbolId
(
id
,
compilation
,
results
);
}
...
...
@@ -90,6 +126,16 @@ public static bool TryGetSymbolsForDeclarationId(string id, Compilation compilat
/// </summary>
public
static
ISymbol
GetFirstSymbolForDeclarationId
(
string
id
,
Compilation
compilation
)
{
if
(
id
==
null
)
{
throw
new
ArgumentNullException
(
nameof
(
id
));
}
if
(
compilation
==
null
)
{
throw
new
ArgumentNullException
(
nameof
(
compilation
));
}
var
results
=
s_symbolListPool
.
Allocate
();
try
{
...
...
@@ -105,23 +151,68 @@ public static ISymbol GetFirstSymbolForDeclarationId(string id, Compilation comp
/// <summary>
/// Gets the symbols that match the reference id string.
/// </summary>
public
static
I
Enumerable
<
ISymbol
>
GetSymbolsForReferenceId
(
string
id
,
Compilation
compilation
)
public
static
I
ReadOnlyList
<
ISymbol
>
GetSymbolsForReferenceId
(
string
id
,
Compilation
compilation
)
{
if
(
id
.
Length
>
1
&&
id
[
0
]
==
'N'
&&
id
[
1
]
==
':'
)
if
(
id
==
null
)
{
return
GetSymbolsForDeclarationId
(
id
,
compilation
);
throw
new
ArgumentNullException
(
nameof
(
id
));
}
if
(
compilation
==
null
)
{
throw
new
ArgumentNullException
(
nameof
(
compilation
));
}
var
results
=
new
List
<
ISymbol
>();
Parser
.
ParseReferencedSymbol
Id
(
id
,
compilation
,
results
);
TryGetSymbolsForReference
Id
(
id
,
compilation
,
results
);
return
results
;
}
/// <summary>
/// Try to get all symbols that match the reference id string.
/// Returns true if atleast one symbol matches.
/// </summary>
/// <remarks>This API is available for possible of reuse of results lists.</remarks>
public
static
bool
TryGetSymbolsForReferenceId
(
string
id
,
Compilation
compilation
,
List
<
ISymbol
>
results
)
{
if
(
id
==
null
)
{
throw
new
ArgumentNullException
(
nameof
(
id
));
}
if
(
compilation
==
null
)
{
throw
new
ArgumentNullException
(
nameof
(
compilation
));
}
if
(
results
==
null
)
{
throw
new
ArgumentNullException
(
nameof
(
results
));
}
if
(
id
.
Length
>
1
&&
id
[
0
]
==
'N'
&&
id
[
1
]
==
':'
)
{
return
TryGetSymbolsForDeclarationId
(
id
,
compilation
,
results
);
}
return
Parser
.
ParseReferencedSymbolId
(
id
,
compilation
,
results
);
}
/// <summary>
/// Gets the first symbol that matches the reference id string, order undefined.
/// </summary>
public
static
ISymbol
GetFirstSymbolForReferenceId
(
string
id
,
Compilation
compilation
)
{
if
(
id
==
null
)
{
throw
new
ArgumentNullException
(
nameof
(
id
));
}
if
(
compilation
==
null
)
{
throw
new
ArgumentNullException
(
nameof
(
compilation
));
}
if
(
id
.
Length
>
1
&&
id
[
0
]
==
'N'
&&
id
[
1
]
==
':'
)
{
return
GetFirstSymbolForDeclarationId
(
id
,
compilation
);
...
...
@@ -524,15 +615,21 @@ public static bool ParseDeclaredSymbolId(string id, Compilation compilation, Lis
int
index
=
0
;
results
.
Clear
();
ParseDeclaredId
(
id
,
ref
index
,
compilation
,
results
);
return
results
.
Count
!=
0
;
return
results
.
Count
>
0
;
}
// only supports type symbols
public
static
void
ParseReferencedSymbolId
(
string
id
,
Compilation
compilation
,
List
<
ISymbol
>
results
)
public
static
bool
ParseReferencedSymbolId
(
string
id
,
Compilation
compilation
,
List
<
ISymbol
>
results
)
{
if
(
id
==
null
)
{
return
false
;
}
int
index
=
0
;
results
.
Clear
();
ParseTypeSymbol
(
id
,
ref
index
,
compilation
,
null
,
results
);
return
results
.
Count
>
0
;
}
private
static
void
ParseDeclaredId
(
string
id
,
ref
int
index
,
Compilation
compilation
,
List
<
ISymbol
>
results
)
...
...
src/Compilers/Core/Portable/PublicAPI.txt
浏览文件 @
06890b67
...
...
@@ -317,6 +317,7 @@ Microsoft.CodeAnalysis.DllImportData.ExactSpelling.get -> bool
Microsoft.CodeAnalysis.DllImportData.ModuleName.get -> string
Microsoft.CodeAnalysis.DllImportData.SetLastError.get -> bool
Microsoft.CodeAnalysis.DllImportData.ThrowOnUnmappableCharacter.get -> bool?
Microsoft.CodeAnalysis.DocumentationCommentId
Microsoft.CodeAnalysis.DocumentationMode
Microsoft.CodeAnalysis.DocumentationMode.Diagnose = 2 -> Microsoft.CodeAnalysis.DocumentationMode
Microsoft.CodeAnalysis.DocumentationMode.None = 0 -> Microsoft.CodeAnalysis.DocumentationMode
...
...
@@ -1915,6 +1916,14 @@ static Microsoft.CodeAnalysis.Diagnostic.Create(string id, string category, Micr
static Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers.GetEffectiveDiagnostics(System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Diagnostic> diagnostics, Microsoft.CodeAnalysis.Compilation compilation) -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Diagnostic>
static Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers.IsDiagnosticAnalyzerSuppressed(Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzer analyzer, Microsoft.CodeAnalysis.CompilationOptions options, System.Action<System.Exception, Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzer, Microsoft.CodeAnalysis.Diagnostic> onAnalyzerException = null) -> bool
static Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzerExtensions.WithAnalyzers(this Microsoft.CodeAnalysis.Compilation compilation, System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzer> analyzers, Microsoft.CodeAnalysis.Diagnostics.AnalyzerOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers
static Microsoft.CodeAnalysis.DocumentationCommentId.CreateDeclarationId(Microsoft.CodeAnalysis.ISymbol symbol) -> string
static Microsoft.CodeAnalysis.DocumentationCommentId.CreateReferenceId(Microsoft.CodeAnalysis.ISymbol symbol) -> string
static Microsoft.CodeAnalysis.DocumentationCommentId.GetFirstSymbolForDeclarationId(string id, Microsoft.CodeAnalysis.Compilation compilation) -> Microsoft.CodeAnalysis.ISymbol
static Microsoft.CodeAnalysis.DocumentationCommentId.GetFirstSymbolForReferenceId(string id, Microsoft.CodeAnalysis.Compilation compilation) -> Microsoft.CodeAnalysis.ISymbol
static Microsoft.CodeAnalysis.DocumentationCommentId.GetSymbolsForDeclarationId(string id, Microsoft.CodeAnalysis.Compilation compilation) -> System.Collections.Generic.IReadOnlyList<Microsoft.CodeAnalysis.ISymbol>
static Microsoft.CodeAnalysis.DocumentationCommentId.GetSymbolsForReferenceId(string id, Microsoft.CodeAnalysis.Compilation compilation) -> System.Collections.Generic.IReadOnlyList<Microsoft.CodeAnalysis.ISymbol>
static Microsoft.CodeAnalysis.DocumentationCommentId.TryGetSymbolsForDeclarationId(string id, Microsoft.CodeAnalysis.Compilation compilation, System.Collections.Generic.List<Microsoft.CodeAnalysis.ISymbol> results) -> bool
static Microsoft.CodeAnalysis.DocumentationCommentId.TryGetSymbolsForReferenceId(string id, Microsoft.CodeAnalysis.Compilation compilation, System.Collections.Generic.List<Microsoft.CodeAnalysis.ISymbol> results) -> bool
static Microsoft.CodeAnalysis.Emit.EditAndContinueMethodDebugInformation.Create(System.Collections.Immutable.ImmutableArray<byte> compressedSlotMap, System.Collections.Immutable.ImmutableArray<byte> compressedLambdaMap) -> Microsoft.CodeAnalysis.Emit.EditAndContinueMethodDebugInformation
static Microsoft.CodeAnalysis.Emit.EmitBaseline.CreateInitialBaseline(Microsoft.CodeAnalysis.ModuleMetadata module, System.Func<System.Reflection.Metadata.MethodDefinitionHandle, Microsoft.CodeAnalysis.Emit.EditAndContinueMethodDebugInformation> debugInformationProvider) -> Microsoft.CodeAnalysis.Emit.EmitBaseline
static Microsoft.CodeAnalysis.Emit.EmitOptions.operator !=(Microsoft.CodeAnalysis.Emit.EmitOptions left, Microsoft.CodeAnalysis.Emit.EmitOptions right) -> bool
...
...
src/Workspaces/Core/Portable/Workspaces.csproj
浏览文件 @
06890b67
...
...
@@ -76,9 +76,6 @@
<Compile
Include=
"..\..\..\Compilers\Core\Portable\InternalUtilities\DecimalUtilities.cs"
>
<Link>
InternalUtilities\DecimalUtilities.cs
</Link>
</Compile>
<Compile
Include=
"..\..\..\Compilers\Core\Portable\InternalUtilities\DocumentationCommentId.cs"
>
<Link>
InternalUtilities\DocumentationCommentId.cs
</Link>
</Compile>
<Compile
Include=
"..\..\..\Compilers\Core\Portable\InternalUtilities\DocumentationCommentXmlNames.cs"
>
<Link>
InternalUtilities\DocumentationCommentXmlNames.cs
</Link>
</Compile>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录