Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
bff8f821
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,发现更多精彩内容 >>
提交
bff8f821
编写于
9月 27, 2016
作者:
C
CyrusNajmabadi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use immutable arrays in more places.
上级
61627a4e
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
30 addition
and
28 deletion
+30
-28
src/Workspaces/Core/Portable/FindSymbols/FindReferences/FindReferencesSearchEngine.cs
.../FindSymbols/FindReferences/FindReferencesSearchEngine.cs
+1
-1
src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/AbstractMethodOrPropertyOrEventSymbolReferenceFinder.cs
...s/AbstractMethodOrPropertyOrEventSymbolReferenceFinder.cs
+1
-2
src/Workspaces/Core/Portable/FindSymbols/SymbolFinder_Declarations.cs
...es/Core/Portable/FindSymbols/SymbolFinder_Declarations.cs
+17
-13
src/Workspaces/Core/Portable/FindSymbols/SymbolFinder_Hierarchy.cs
...paces/Core/Portable/FindSymbols/SymbolFinder_Hierarchy.cs
+10
-11
src/Workspaces/Core/Portable/FindSymbols/SymbolFinder_References.cs
...aces/Core/Portable/FindSymbols/SymbolFinder_References.cs
+1
-1
未找到文件。
src/Workspaces/Core/Portable/FindSymbols/FindReferences/FindReferencesSearchEngine.cs
浏览文件 @
bff8f821
...
...
@@ -56,7 +56,7 @@ internal partial class FindReferencesSearchEngine
_progressTracker
=
new
StreamingProgressTracker
(
progress
.
ReportProgressAsync
);
}
public
async
Task
<
I
Enumerable
<
ReferencedSymbol
>>
FindReferencesAsync
(
public
async
Task
<
I
mmutableArray
<
ReferencedSymbol
>>
FindReferencesAsync
(
SymbolAndProjectId
symbolAndProjectId
)
{
await
_progress
.
OnStartedAsync
().
ConfigureAwait
(
false
);
...
...
src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/AbstractMethodOrPropertyOrEventSymbolReferenceFinder.cs
浏览文件 @
bff8f821
...
...
@@ -37,9 +37,8 @@ protected AbstractMethodOrPropertyOrEventSymbolReferenceFinder()
{
// We have a normal method. Find any interface methods that it implicitly or
// explicitly implements and cascade down to those.
var
interfaceMembersImplemented
Stream
=
await
SymbolFinder
.
FindImplementedInterfaceMembersAsync
(
var
interfaceMembersImplemented
=
await
SymbolFinder
.
FindImplementedInterfaceMembersAsync
(
symbolAndProjectId
,
solution
,
projects
,
cancellationToken
).
ConfigureAwait
(
false
);
var
interfaceMembersImplemented
=
interfaceMembersImplementedStream
.
ToImmutableArray
();
// Finally, methods can cascade through virtual/override inheritance. NOTE(cyrusn):
// We only need to go up or down one level. Then, when we're finding references on
...
...
src/Workspaces/Core/Portable/FindSymbols/SymbolFinder_Declarations.cs
浏览文件 @
bff8f821
...
...
@@ -336,7 +336,8 @@ public static Task<IEnumerable<ISymbol>> FindSourceDeclarationsAsync(Solution so
/// <summary>
/// Find the symbols for declarations made in source with the specified name.
/// </summary>
public
static
Task
<
IEnumerable
<
ISymbol
>>
FindSourceDeclarationsAsync
(
Solution
solution
,
string
name
,
bool
ignoreCase
,
SymbolFilter
filter
,
CancellationToken
cancellationToken
=
default
(
CancellationToken
))
public
static
async
Task
<
IEnumerable
<
ISymbol
>>
FindSourceDeclarationsAsync
(
Solution
solution
,
string
name
,
bool
ignoreCase
,
SymbolFilter
filter
,
CancellationToken
cancellationToken
=
default
(
CancellationToken
))
{
if
(
solution
==
null
)
{
...
...
@@ -350,24 +351,25 @@ public static Task<IEnumerable<ISymbol>> FindSourceDeclarationsAsync(Solution so
if
(
string
.
IsNullOrWhiteSpace
(
name
))
{
return
SpecializedTasks
.
EmptyEnumerable
<
ISymbol
>()
;
return
ImmutableArray
<
ISymbol
>.
Empty
;
}
using
(
Logger
.
LogBlock
(
FunctionId
.
SymbolFinder_Solution_Name_FindSourceDeclarationsAsync
,
cancellationToken
))
{
return
FindSourceDeclarationsAsyncImpl
(
solution
,
SearchQuery
.
Create
(
name
,
ignoreCase
),
filter
,
cancellationToken
);
return
await
FindSourceDeclarationsAsyncImpl
(
solution
,
SearchQuery
.
Create
(
name
,
ignoreCase
),
filter
,
cancellationToken
).
ConfigureAwait
(
false
);
}
}
private
static
async
Task
<
I
Enumerable
<
ISymbol
>>
FindSourceDeclarationsAsyncImpl
(
private
static
async
Task
<
I
mmutableArray
<
ISymbol
>>
FindSourceDeclarationsAsyncImpl
(
Solution
solution
,
SearchQuery
query
,
SymbolFilter
filter
,
CancellationToken
cancellationToken
)
{
if
(
query
.
Name
!=
null
&&
string
.
IsNullOrWhiteSpace
(
query
.
Name
))
{
return
SpecializedCollections
.
EmptyEnumerable
<
ISymbol
>()
;
return
ImmutableArray
<
ISymbol
>.
Empty
;
}
var
result
=
new
List
<
ISymbol
>
();
var
result
=
ArrayBuilder
<
ISymbol
>.
GetInstance
();
foreach
(
var
projectId
in
solution
.
ProjectIds
)
{
var
project
=
solution
.
GetProject
(
projectId
);
...
...
@@ -375,7 +377,7 @@ public static Task<IEnumerable<ISymbol>> FindSourceDeclarationsAsync(Solution so
result
.
AddRange
(
symbols
);
}
return
result
;
return
result
.
ToImmutableAndFree
()
;
}
/// <summary>
...
...
@@ -433,13 +435,15 @@ public static Task<IEnumerable<ISymbol>> FindSourceDeclarationsAsync(Solution so
/// <summary>
/// Find the symbols for declarations made in source with a matching name.
/// </summary>
public
static
Task
<
IEnumerable
<
ISymbol
>>
FindSourceDeclarationsAsync
(
public
static
async
Task
<
IEnumerable
<
ISymbol
>>
FindSourceDeclarationsAsync
(
Solution
solution
,
Func
<
string
,
bool
>
predicate
,
SymbolFilter
filter
,
CancellationToken
cancellationToken
=
default
(
CancellationToken
))
{
return
FindSourceDeclarationsAsync
(
solution
,
SearchQuery
.
CreateCustom
(
predicate
),
filter
,
cancellationToken
);
return
await
FindSourceDeclarationsAsync
(
solution
,
SearchQuery
.
CreateCustom
(
predicate
),
filter
,
cancellationToken
).
ConfigureAwait
(
false
);
}
internal
static
async
Task
<
IEnumerable
<
ISymbol
>>
FindSourceDeclarationsAsync
(
Solution
solution
,
SearchQuery
query
,
SymbolFilter
filter
,
CancellationToken
cancellationToken
)
internal
static
async
Task
<
ImmutableArray
<
ISymbol
>>
FindSourceDeclarationsAsync
(
Solution
solution
,
SearchQuery
query
,
SymbolFilter
filter
,
CancellationToken
cancellationToken
)
{
if
(
solution
==
null
)
{
...
...
@@ -448,12 +452,12 @@ internal static async Task<IEnumerable<ISymbol>> FindSourceDeclarationsAsync(Sol
if
(
query
.
Name
!=
null
&&
string
.
IsNullOrWhiteSpace
(
query
.
Name
))
{
return
SpecializedCollections
.
EmptyEnumerable
<
ISymbol
>()
;
return
ImmutableArray
<
ISymbol
>.
Empty
;
}
using
(
Logger
.
LogBlock
(
FunctionId
.
SymbolFinder_Solution_Predicate_FindSourceDeclarationsAsync
,
cancellationToken
))
{
var
result
=
new
List
<
ISymbol
>
();
var
result
=
ArrayBuilder
<
ISymbol
>.
GetInstance
();
foreach
(
var
projectId
in
solution
.
ProjectIds
)
{
var
project
=
solution
.
GetProject
(
projectId
);
...
...
@@ -461,7 +465,7 @@ internal static async Task<IEnumerable<ISymbol>> FindSourceDeclarationsAsync(Sol
result
.
AddRange
(
symbols
);
}
return
result
;
return
result
.
ToImmutableAndFree
()
;
}
}
...
...
src/Workspaces/Core/Portable/FindSymbols/SymbolFinder_Hierarchy.cs
浏览文件 @
bff8f821
...
...
@@ -78,10 +78,10 @@ public static partial class SymbolFinder
var
result
=
await
FindImplementedInterfaceMembersAsync
(
SymbolAndProjectId
.
Create
(
symbol
,
projectId
:
null
),
solution
,
projects
,
cancellationToken
).
ConfigureAwait
(
false
);
return
result
.
Select
(
s
=>
s
.
Symbol
).
ToList
(
);
return
result
.
Select
AsArray
(
s
=>
s
.
Symbol
);
}
internal
static
async
Task
<
I
Enumerable
<
SymbolAndProjectId
>>
FindImplementedInterfaceMembersAsync
(
internal
static
async
Task
<
I
mmutableArray
<
SymbolAndProjectId
>>
FindImplementedInterfaceMembersAsync
(
SymbolAndProjectId
symbolAndProjectId
,
Solution
solution
,
IImmutableSet
<
Project
>
projects
=
null
,
CancellationToken
cancellationToken
=
default
(
CancellationToken
))
{
// Member can only implement interface members if it is an explicit member, or if it is
...
...
@@ -92,7 +92,7 @@ public static partial class SymbolFinder
var
explicitImplementations
=
symbol
.
ExplicitInterfaceImplementations
();
if
(
explicitImplementations
.
Length
>
0
)
{
return
explicitImplementations
.
Select
(
symbolAndProjectId
.
WithSymbol
);
return
explicitImplementations
.
Select
AsArray
(
symbolAndProjectId
.
WithSymbol
);
}
else
if
(
symbol
.
DeclaredAccessibility
==
Accessibility
.
Public
&&
!
symbol
.
IsStatic
&&
...
...
@@ -116,7 +116,7 @@ public static partial class SymbolFinder
containingType
,
solution
,
projects
,
cancellationToken
).
ConfigureAwait
(
false
);
var
allTypes
=
derivedClasses
.
Concat
(
containingType
);
List
<
SymbolAndProjectId
>
results
=
null
;
var
builder
=
ArrayBuilder
<
SymbolAndProjectId
>.
GetInstance
()
;
foreach
(
var
type
in
allTypes
.
Convert
<
INamedTypeSymbol
,
ITypeSymbol
>())
{
...
...
@@ -136,8 +136,7 @@ public static partial class SymbolFinder
if
(
implementation
.
Symbol
!=
null
&&
SymbolEquivalenceComparer
.
Instance
.
Equals
(
implementation
.
Symbol
.
OriginalDefinition
,
symbol
.
OriginalDefinition
))
{
results
=
results
??
new
List
<
SymbolAndProjectId
>();
results
.
Add
(
bestMethod
);
builder
.
Add
(
bestMethod
);
}
}
}
...
...
@@ -145,14 +144,14 @@ public static partial class SymbolFinder
}
}
if
(
results
!=
null
)
{
return
results
.
Distinct
(
SymbolAndProjectIdComparer
.
SymbolEquivalenceInstance
);
}
var
result
=
builder
.
Distinct
(
SymbolAndProjectIdComparer
.
SymbolEquivalenceInstance
)
.
ToImmutableArray
();
builder
.
Free
(
);
return
result
;
}
}
return
SpecializedCollections
.
EmptyEnumerable
<
SymbolAndProjectId
>()
;
return
ImmutableArray
<
SymbolAndProjectId
>.
Empty
;
}
private
static
IEnumerable
<
SymbolAndProjectId
>
GetMembers
(
...
...
src/Workspaces/Core/Portable/FindSymbols/SymbolFinder_References.cs
浏览文件 @
bff8f821
...
...
@@ -90,7 +90,7 @@ public static partial class SymbolFinder
}
}
internal
static
async
Task
<
I
Enumerable
<
ReferencedSymbol
>>
FindRenamableReferencesAsync
(
internal
static
async
Task
<
I
mmutableArray
<
ReferencedSymbol
>>
FindRenamableReferencesAsync
(
SymbolAndProjectId
symbolAndProjectId
,
Solution
solution
,
CancellationToken
cancellationToken
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录