Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
f2ea263a
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,发现更多精彩内容 >>
提交
f2ea263a
编写于
6月 12, 2017
作者:
C
CyrusNajmabadi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Key off the type and hte projects being searched.
上级
2cdb184e
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
13 addition
and
10 deletion
+13
-10
src/Workspaces/Core/Portable/FindSymbols/FindReferences/DependentTypeFinder.cs
...ortable/FindSymbols/FindReferences/DependentTypeFinder.cs
+13
-10
未找到文件。
src/Workspaces/Core/Portable/FindSymbols/FindReferences/DependentTypeFinder.cs
浏览文件 @
f2ea263a
...
@@ -18,7 +18,7 @@ namespace Microsoft.CodeAnalysis.FindSymbols
...
@@ -18,7 +18,7 @@ namespace Microsoft.CodeAnalysis.FindSymbols
{
{
using
SymbolAndProjectIdSet
=
HashSet
<
SymbolAndProjectId
<
INamedTypeSymbol
>>;
using
SymbolAndProjectIdSet
=
HashSet
<
SymbolAndProjectId
<
INamedTypeSymbol
>>;
using
RelatedTypeCache
=
ConditionalWeakTable
<
Solution
,
ConcurrentDictionary
<
INamedTypeSymbol
,
AsyncLazy
<
ImmutableArray
<
SymbolAndProjectId
<
INamedTypeSymbol
>>>>>;
using
RelatedTypeCache
=
ConditionalWeakTable
<
Solution
,
ConcurrentDictionary
<
(
INamedTypeSymbol
,
IImmutableSet
<
Project
>)
,
AsyncLazy
<
ImmutableArray
<
SymbolAndProjectId
<
INamedTypeSymbol
>>>>>;
/// <summary>
/// <summary>
/// Provides helper methods for finding dependent types (derivations, implementations,
/// Provides helper methods for finding dependent types (derivations, implementations,
...
@@ -56,12 +56,13 @@ internal static class DependentTypeFinder
...
@@ -56,12 +56,13 @@ internal static class DependentTypeFinder
public
static
async
Task
<
ImmutableArray
<
SymbolAndProjectId
<
INamedTypeSymbol
>>>
FindTypesFromCacheOrComputeAsync
(
public
static
async
Task
<
ImmutableArray
<
SymbolAndProjectId
<
INamedTypeSymbol
>>>
FindTypesFromCacheOrComputeAsync
(
INamedTypeSymbol
type
,
INamedTypeSymbol
type
,
Solution
solution
,
Solution
solution
,
IImmutableSet
<
Project
>
projects
,
RelatedTypeCache
cache
,
RelatedTypeCache
cache
,
Func
<
CancellationToken
,
Task
<
ImmutableArray
<
SymbolAndProjectId
<
INamedTypeSymbol
>>>>
findAsync
,
Func
<
CancellationToken
,
Task
<
ImmutableArray
<
SymbolAndProjectId
<
INamedTypeSymbol
>>>>
findAsync
,
CancellationToken
cancellationToken
)
CancellationToken
cancellationToken
)
{
{
var
dictionary
=
cache
.
GetOrCreateValue
(
solution
);
var
dictionary
=
cache
.
GetOrCreateValue
(
solution
);
var
lazy
=
dictionary
.
GetOrAdd
(
type
,
new
AsyncLazy
<
ImmutableArray
<
SymbolAndProjectId
<
INamedTypeSymbol
>>>(
var
lazy
=
dictionary
.
GetOrAdd
(
(
type
,
projects
)
,
new
AsyncLazy
<
ImmutableArray
<
SymbolAndProjectId
<
INamedTypeSymbol
>>>(
asynchronousComputeFunction
:
findAsync
,
cacheResult
:
true
));
asynchronousComputeFunction
:
findAsync
,
cacheResult
:
true
));
return
await
lazy
.
GetValueAsync
(
cancellationToken
).
ConfigureAwait
(
false
);
return
await
lazy
.
GetValueAsync
(
cancellationToken
).
ConfigureAwait
(
false
);
...
@@ -76,11 +77,12 @@ internal static class DependentTypeFinder
...
@@ -76,11 +77,12 @@ internal static class DependentTypeFinder
CancellationToken
cancellationToken
)
CancellationToken
cancellationToken
)
{
{
return
FindTypesFromCacheOrComputeAsync
(
return
FindTypesFromCacheOrComputeAsync
(
type
,
solution
,
s_typeToImmediatelyDerivedClassesMap
,
type
,
solution
,
projects
:
null
,
c
=>
FindDerivedClassesAsync
(
cache
:
s_typeToImmediatelyDerivedClassesMap
,
findAsync
:
c
=>
FindDerivedClassesAsync
(
SymbolAndProjectId
.
Create
(
type
,
projectId
:
null
),
solution
,
projects
:
null
,
SymbolAndProjectId
.
Create
(
type
,
projectId
:
null
),
solution
,
projects
:
null
,
transitive
:
false
,
cancellationToken
:
c
),
transitive
:
false
,
cancellationToken
:
c
),
cancellationToken
);
cancellationToken
:
cancellationToken
);
}
}
/// <summary>
/// <summary>
...
@@ -93,7 +95,7 @@ internal static class DependentTypeFinder
...
@@ -93,7 +95,7 @@ internal static class DependentTypeFinder
CancellationToken
cancellationToken
)
CancellationToken
cancellationToken
)
{
{
return
FindTypesFromCacheOrComputeAsync
(
return
FindTypesFromCacheOrComputeAsync
(
type
,
solution
,
s_typeToTransitivelyDerivedClassesMap
,
type
,
solution
,
projects
,
s_typeToTransitivelyDerivedClassesMap
,
c
=>
FindDerivedClassesAsync
(
c
=>
FindDerivedClassesAsync
(
SymbolAndProjectId
.
Create
(
type
,
projectId
:
null
),
solution
,
projects
,
SymbolAndProjectId
.
Create
(
type
,
projectId
:
null
),
solution
,
projects
,
transitive
:
true
,
cancellationToken
:
c
),
transitive
:
true
,
cancellationToken
:
c
),
...
@@ -137,7 +139,7 @@ internal static class DependentTypeFinder
...
@@ -137,7 +139,7 @@ internal static class DependentTypeFinder
CancellationToken
cancellationToken
)
CancellationToken
cancellationToken
)
{
{
return
FindTypesFromCacheOrComputeAsync
(
return
FindTypesFromCacheOrComputeAsync
(
type
,
solution
,
s_typeToTransitivelyImplementingTypesMap
,
type
,
solution
,
projects
,
s_typeToTransitivelyImplementingTypesMap
,
c
=>
FindTransitivelyImplementingTypesWorkerAsync
(
type
,
solution
,
projects
,
c
),
c
=>
FindTransitivelyImplementingTypesWorkerAsync
(
type
,
solution
,
projects
,
c
),
cancellationToken
);
cancellationToken
);
}
}
...
@@ -166,11 +168,12 @@ internal static class DependentTypeFinder
...
@@ -166,11 +168,12 @@ internal static class DependentTypeFinder
CancellationToken
cancellationToken
)
CancellationToken
cancellationToken
)
{
{
return
FindTypesFromCacheOrComputeAsync
(
return
FindTypesFromCacheOrComputeAsync
(
type
,
solution
,
s_typeToImmediatelyDerivedAndImplementingTypesMap
,
type
,
solution
,
projects
:
null
,
c
=>
FindDerivedAndImplementingTypesAsync
(
cache
:
s_typeToImmediatelyDerivedAndImplementingTypesMap
,
findAsync
:
c
=>
FindDerivedAndImplementingTypesAsync
(
SymbolAndProjectId
.
Create
(
type
,
projectId
:
null
),
solution
,
projects
:
null
,
SymbolAndProjectId
.
Create
(
type
,
projectId
:
null
),
solution
,
projects
:
null
,
transitive
:
false
,
cancellationToken
:
c
),
transitive
:
false
,
cancellationToken
:
c
),
cancellationToken
);
cancellationToken
:
cancellationToken
);
}
}
private
static
Task
<
ImmutableArray
<
SymbolAndProjectId
<
INamedTypeSymbol
>>>
FindDerivedAndImplementingTypesAsync
(
private
static
Task
<
ImmutableArray
<
SymbolAndProjectId
<
INamedTypeSymbol
>>>
FindDerivedAndImplementingTypesAsync
(
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录