Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
0662815a
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,发现更多精彩内容 >>
提交
0662815a
编写于
5月 16, 2016
作者:
C
CyrusNajmabadi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Rename type.
上级
28f6f3e7
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
14 addition
and
14 deletion
+14
-14
src/Workspaces/Core/Portable/FindSymbols/FindReferences/DependentTypeFinder.cs
...ortable/FindSymbols/FindReferences/DependentTypeFinder.cs
+14
-14
未找到文件。
src/Workspaces/Core/Portable/FindSymbols/FindReferences/DependentTypeFinder.cs
浏览文件 @
0662815a
...
...
@@ -474,17 +474,17 @@ internal static class DependentTypeFinder
var
typesToSearchFor
=
new
HashSet
<
INamedTypeSymbol
>(
SymbolEquivalenceComparer
.
Instance
);
typesToSearchFor
.
AddAll
(
sourceAndMetadataTypes
);
var
inheritance
Info
=
new
InheritanceInfo
(
sourceAndMetadataTypes
);
var
inheritance
Query
=
new
InheritanceQuery
(
sourceAndMetadataTypes
);
// As long as there are new types to search for, keep looping.
while
(
typesToSearchFor
.
Count
>
0
)
{
// Compute the set of names to look for in the base/interface lists.
inheritance
Info
.
TypeNames
.
AddRange
(
typesToSearchFor
.
Select
(
c
=>
c
.
Name
));
inheritance
Query
.
TypeNames
.
AddRange
(
typesToSearchFor
.
Select
(
c
=>
c
.
Name
));
// Search all the documents of this project in parallel.
var
tasks
=
project
.
Documents
.
Select
(
d
=>
FindImmediatelyInheritingTypesInDocumentAsync
(
d
,
typesToSearchFor
,
inheritance
Info
,
d
,
typesToSearchFor
,
inheritance
Query
,
cachedModels
,
cachedInfos
,
sourceTypeImmediatelyMatches
,
cancellationToken
)).
ToArray
();
...
...
@@ -494,7 +494,7 @@ internal static class DependentTypeFinder
// fill these in if we discover any more types that we need to keep searching
// for.
typesToSearchFor
.
Clear
();
inheritance
Info
.
TypeNames
.
Clear
();
inheritance
Query
.
TypeNames
.
Clear
();
foreach
(
var
task
in
tasks
)
{
...
...
@@ -539,7 +539,7 @@ internal static class DependentTypeFinder
private
static
async
Task
<
IEnumerable
<
INamedTypeSymbol
>>
FindImmediatelyInheritingTypesInDocumentAsync
(
Document
document
,
HashSet
<
INamedTypeSymbol
>
typesToSearchFor
,
Inheritance
Info
inheritanceInfo
,
Inheritance
Query
inheritanceQuery
,
ConcurrentSet
<
SemanticModel
>
cachedModels
,
ConcurrentSet
<
IDeclarationInfo
>
cachedInfos
,
Func
<
HashSet
<
INamedTypeSymbol
>,
INamedTypeSymbol
,
bool
>
typeImmediatelyMatches
,
...
...
@@ -554,7 +554,7 @@ internal static class DependentTypeFinder
result
=
await
ProcessSymbolInfo
(
document
,
symbolInfo
,
typesToSearchFor
,
inheritance
Info
,
cachedModels
,
inheritance
Query
,
cachedModels
,
typeImmediatelyMatches
,
result
,
cancellationToken
).
ConfigureAwait
(
false
);
}
...
...
@@ -565,7 +565,7 @@ internal static class DependentTypeFinder
Document
document
,
DeclaredSymbolInfo
info
,
HashSet
<
INamedTypeSymbol
>
typesToSearchFor
,
Inheritance
Info
inheritanceInfo
,
Inheritance
Query
inheritanceQuery
,
ConcurrentSet
<
SemanticModel
>
cachedModels
,
Func
<
HashSet
<
INamedTypeSymbol
>,
INamedTypeSymbol
,
bool
>
typeImmediatelyMatches
,
HashSet
<
INamedTypeSymbol
>
result
,
...
...
@@ -573,9 +573,9 @@ internal static class DependentTypeFinder
{
// If we're searching for enums/structs/delegates, then we can just look at the kind of
// the info to see if we have a match.
if
((
inheritance
Info
.
DerivesFromSystemEnum
&&
info
.
Kind
==
DeclaredSymbolInfoKind
.
Enum
)
||
(
inheritance
Info
.
DerivesFromSystemValueType
&&
info
.
Kind
==
DeclaredSymbolInfoKind
.
Struct
)
||
(
inheritance
Info
.
DerivesFromSystemMulticastDelegate
&&
info
.
Kind
==
DeclaredSymbolInfoKind
.
Delegate
))
if
((
inheritance
Query
.
DerivesFromSystemEnum
&&
info
.
Kind
==
DeclaredSymbolInfoKind
.
Enum
)
||
(
inheritance
Query
.
DerivesFromSystemValueType
&&
info
.
Kind
==
DeclaredSymbolInfoKind
.
Struct
)
||
(
inheritance
Query
.
DerivesFromSystemMulticastDelegate
&&
info
.
Kind
==
DeclaredSymbolInfoKind
.
Delegate
))
{
var
symbol
=
await
ResolveAsync
(
document
,
info
,
cachedModels
,
cancellationToken
).
ConfigureAwait
(
false
)
as
INamedTypeSymbol
;
if
(
symbol
!=
null
)
...
...
@@ -584,7 +584,7 @@ internal static class DependentTypeFinder
result
.
Add
(
symbol
);
}
}
else
if
(
inheritance
Info
.
DerivesFromSystemObject
&&
info
.
Kind
==
DeclaredSymbolInfoKind
.
Class
)
else
if
(
inheritance
Query
.
DerivesFromSystemObject
&&
info
.
Kind
==
DeclaredSymbolInfoKind
.
Class
)
{
// Searching for types derived from 'Object' needs to be handled specially.
// There may be no indication in source what the type actually derives from.
...
...
@@ -598,7 +598,7 @@ internal static class DependentTypeFinder
result
.
Add
(
symbol
);
}
}
else
if
(
AnyInheritanceNamesMatch
(
info
,
inheritance
Info
.
TypeNames
))
else
if
(
AnyInheritanceNamesMatch
(
info
,
inheritance
Query
.
TypeNames
))
{
// Looks like we have a potential match. Actually check if the symbol is viable.
var
symbol
=
await
ResolveAsync
(
document
,
info
,
cachedModels
,
cancellationToken
).
ConfigureAwait
(
false
)
as
INamedTypeSymbol
;
...
...
@@ -651,7 +651,7 @@ internal static class DependentTypeFinder
t
.
IsAccessibleWithin
(
c
.
Assembly
)).
ToList
());
}
private
class
Inheritance
Info
private
class
Inheritance
Query
{
public
readonly
bool
DerivesFromSystemObject
;
public
readonly
bool
DerivesFromSystemValueType
;
...
...
@@ -660,7 +660,7 @@ private class InheritanceInfo
public
readonly
HashSet
<
string
>
TypeNames
;
public
Inheritance
Info
(
HashSet
<
INamedTypeSymbol
>
sourceAndMetadataTypes
)
public
Inheritance
Query
(
HashSet
<
INamedTypeSymbol
>
sourceAndMetadataTypes
)
{
DerivesFromSystemObject
=
sourceAndMetadataTypes
.
Any
(
t
=>
t
.
SpecialType
==
SpecialType
.
System_Object
);
DerivesFromSystemValueType
=
sourceAndMetadataTypes
.
Any
(
t
=>
t
.
SpecialType
==
SpecialType
.
System_ValueType
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录