Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
e19286c5
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,发现更多精彩内容 >>
提交
e19286c5
编写于
1月 27, 2020
作者:
S
Sam Harwell
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use consistent calling convention for updates
上级
63612753
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
24 addition
and
20 deletion
+24
-20
src/Workspaces/Core/Portable/Workspace/Solution/ProjectDependencyGraph_AddProjectReference.cs
...ce/Solution/ProjectDependencyGraph_AddProjectReference.cs
+6
-7
src/Workspaces/Core/Portable/Workspace/Solution/ProjectDependencyGraph_RemoveProject.cs
...orkspace/Solution/ProjectDependencyGraph_RemoveProject.cs
+12
-8
src/Workspaces/Core/Portable/Workspace/Solution/ProjectDependencyGraph_RemoveProjectReference.cs
...Solution/ProjectDependencyGraph_RemoveProjectReference.cs
+6
-5
未找到文件。
src/Workspaces/Core/Portable/Workspace/Solution/ProjectDependencyGraph_AddProjectReference.cs
浏览文件 @
e19286c5
...
@@ -23,10 +23,7 @@ internal ProjectDependencyGraph WithAdditionalProjectReferences(ProjectId projec
...
@@ -23,10 +23,7 @@ internal ProjectDependencyGraph WithAdditionalProjectReferences(ProjectId projec
var
newReferencesMap
=
ComputeNewReferencesMapForAdditionalProjectReferences
(
_referencesMap
,
projectId
,
referencedProjectIds
);
var
newReferencesMap
=
ComputeNewReferencesMapForAdditionalProjectReferences
(
_referencesMap
,
projectId
,
referencedProjectIds
);
var
newReverseReferencesMap
=
var
newReverseReferencesMap
=
ComputeNewReverseReferencesMapForAdditionalProjectReferences
(
_lazyReverseReferencesMap
,
projectId
,
referencedProjectIds
);
_lazyReverseReferencesMap
!=
null
?
ComputeNewReverseReferencesMapForAdditionalProjectReferences
(
_lazyReverseReferencesMap
,
projectId
,
referencedProjectIds
)
:
null
;
var
newTransitiveReferencesMap
=
ComputeNewTransitiveReferencesMapForAdditionalProjectReferences
(
_transitiveReferencesMap
,
projectId
,
referencedProjectIds
);
var
newTransitiveReferencesMap
=
ComputeNewTransitiveReferencesMapForAdditionalProjectReferences
(
_transitiveReferencesMap
,
projectId
,
referencedProjectIds
);
...
@@ -64,13 +61,15 @@ internal ProjectDependencyGraph WithAdditionalProjectReferences(ProjectId projec
...
@@ -64,13 +61,15 @@ internal ProjectDependencyGraph WithAdditionalProjectReferences(ProjectId projec
/// <summary>
/// <summary>
/// Computes a new <see cref="_lazyReverseReferencesMap"/> for the addition of additional project references.
/// Computes a new <see cref="_lazyReverseReferencesMap"/> for the addition of additional project references.
/// Must be called on a non-null map.
/// </summary>
/// </summary>
private
static
ImmutableDictionary
<
ProjectId
,
ImmutableHashSet
<
ProjectId
>>
ComputeNewReverseReferencesMapForAdditionalProjectReferences
(
private
static
ImmutableDictionary
<
ProjectId
,
ImmutableHashSet
<
ProjectId
>>
?
ComputeNewReverseReferencesMapForAdditionalProjectReferences
(
ImmutableDictionary
<
ProjectId
,
ImmutableHashSet
<
ProjectId
>>
existingReverseReferencesMap
,
ImmutableDictionary
<
ProjectId
,
ImmutableHashSet
<
ProjectId
>>
?
existingReverseReferencesMap
,
ProjectId
projectId
,
ProjectId
projectId
,
IReadOnlyList
<
ProjectId
>
referencedProjectIds
)
IReadOnlyList
<
ProjectId
>
referencedProjectIds
)
{
{
if
(
existingReverseReferencesMap
is
null
)
return
null
;
var
builder
=
existingReverseReferencesMap
.
ToBuilder
();
var
builder
=
existingReverseReferencesMap
.
ToBuilder
();
foreach
(
var
referencedProject
in
referencedProjectIds
)
foreach
(
var
referencedProject
in
referencedProjectIds
)
...
...
src/Workspaces/Core/Portable/Workspace/Solution/ProjectDependencyGraph_RemoveProject.cs
浏览文件 @
e19286c5
...
@@ -23,12 +23,10 @@ internal ProjectDependencyGraph WithProjectRemoved(ProjectId projectId)
...
@@ -23,12 +23,10 @@ internal ProjectDependencyGraph WithProjectRemoved(ProjectId projectId)
// The direct reverse references map is updated by removing the key for the project getting removed, and
// The direct reverse references map is updated by removing the key for the project getting removed, and
// also updating any direct references to the removed project.
// also updating any direct references to the removed project.
var
reverseReferencesMap
=
_lazyReverseReferencesMap
is
object
var
reverseReferencesMap
=
ComputeNewReverseReferencesMapForRemovedProject
(
?
ComputeNewReverseReferencesMapForRemovedProject
(
existingForwardReferencesMap
:
_referencesMap
,
existingForwardReferencesMap
:
_referencesMap
,
existingReverseReferencesMap
:
_lazyReverseReferencesMap
,
existingReverseReferencesMap
:
_lazyReverseReferencesMap
,
projectId
);
projectId
)
:
null
;
var
transitiveReferencesMap
=
ComputeNewTransitiveReferencesMapForRemovedProject
(
_transitiveReferencesMap
,
projectId
);
var
transitiveReferencesMap
=
ComputeNewTransitiveReferencesMapForRemovedProject
(
_transitiveReferencesMap
,
projectId
);
var
reverseTransitiveReferencesMap
=
ComputeNewReverseTransitiveReferencesMapForRemovedProject
(
_reverseTransitiveReferencesMap
,
projectId
);
var
reverseTransitiveReferencesMap
=
ComputeNewReverseTransitiveReferencesMapForRemovedProject
(
_reverseTransitiveReferencesMap
,
projectId
);
return
new
ProjectDependencyGraph
(
return
new
ProjectDependencyGraph
(
...
@@ -84,11 +82,17 @@ internal ProjectDependencyGraph WithProjectRemoved(ProjectId projectId)
...
@@ -84,11 +82,17 @@ internal ProjectDependencyGraph WithProjectRemoved(ProjectId projectId)
/// <summary>
/// <summary>
/// Computes a new <see cref="_lazyReverseReferencesMap"/> for the removal of a project.
/// Computes a new <see cref="_lazyReverseReferencesMap"/> for the removal of a project.
/// </summary>
/// </summary>
private
static
ImmutableDictionary
<
ProjectId
,
ImmutableHashSet
<
ProjectId
>>
ComputeNewReverseReferencesMapForRemovedProject
(
private
static
ImmutableDictionary
<
ProjectId
,
ImmutableHashSet
<
ProjectId
>>
?
ComputeNewReverseReferencesMapForRemovedProject
(
ImmutableDictionary
<
ProjectId
,
ImmutableHashSet
<
ProjectId
>>
existingForwardReferencesMap
,
ImmutableDictionary
<
ProjectId
,
ImmutableHashSet
<
ProjectId
>>
existingForwardReferencesMap
,
ImmutableDictionary
<
ProjectId
,
ImmutableHashSet
<
ProjectId
>>
existingReverseReferencesMap
,
ImmutableDictionary
<
ProjectId
,
ImmutableHashSet
<
ProjectId
>>
?
existingReverseReferencesMap
,
ProjectId
projectId
)
ProjectId
projectId
)
{
{
if
(
existingReverseReferencesMap
is
null
)
{
// The map was never calculated for the previous graph, so there is nothing to update.
return
null
;
}
var
builder
=
existingReverseReferencesMap
.
ToBuilder
();
var
builder
=
existingReverseReferencesMap
.
ToBuilder
();
// Iterate over each project referenced by 'projectId', which is now being removed. Update the reverse
// Iterate over each project referenced by 'projectId', which is now being removed. Update the reverse
...
...
src/Workspaces/Core/Portable/Workspace/Solution/ProjectDependencyGraph_RemoveProjectReference.cs
浏览文件 @
e19286c5
...
@@ -20,9 +20,7 @@ internal ProjectDependencyGraph WithProjectReferenceRemoved(ProjectId projectId,
...
@@ -20,9 +20,7 @@ internal ProjectDependencyGraph WithProjectReferenceRemoved(ProjectId projectId,
// Incrementally update the graph
// Incrementally update the graph
var
referencesMap
=
_referencesMap
.
SetItem
(
projectId
,
_referencesMap
[
projectId
].
Remove
(
referencedProjectId
));
var
referencesMap
=
_referencesMap
.
SetItem
(
projectId
,
_referencesMap
[
projectId
].
Remove
(
referencedProjectId
));
var
reverseReferencesMap
=
_lazyReverseReferencesMap
is
object
var
reverseReferencesMap
=
ComputeNewReverseReferencesMapForRemovedProjectReference
(
_lazyReverseReferencesMap
,
projectId
,
referencedProjectId
);
?
ComputeNewReverseReferencesMapForRemovedProjectReference
(
_lazyReverseReferencesMap
,
projectId
,
referencedProjectId
)
:
null
;
var
transitiveReferencesMap
=
ComputeNewTransitiveReferencesMapForRemovedProjectReference
(
_transitiveReferencesMap
,
projectId
,
referencedProjectId
);
var
transitiveReferencesMap
=
ComputeNewTransitiveReferencesMapForRemovedProjectReference
(
_transitiveReferencesMap
,
projectId
,
referencedProjectId
);
var
reverseTransitiveReferencesMap
=
ComputeNewReverseTransitiveReferencesMapForRemovedProjectReference
(
_reverseTransitiveReferencesMap
,
projectId
,
referencedProjectId
);
var
reverseTransitiveReferencesMap
=
ComputeNewReverseTransitiveReferencesMapForRemovedProjectReference
(
_reverseTransitiveReferencesMap
,
projectId
,
referencedProjectId
);
...
@@ -36,11 +34,14 @@ internal ProjectDependencyGraph WithProjectReferenceRemoved(ProjectId projectId,
...
@@ -36,11 +34,14 @@ internal ProjectDependencyGraph WithProjectReferenceRemoved(ProjectId projectId,
dependencySets
:
default
);
dependencySets
:
default
);
}
}
private
ImmutableDictionary
<
ProjectId
,
ImmutableHashSet
<
ProjectId
>>
ComputeNewReverseReferencesMapForRemovedProjectReference
(
private
ImmutableDictionary
<
ProjectId
,
ImmutableHashSet
<
ProjectId
>>
?
ComputeNewReverseReferencesMapForRemovedProjectReference
(
ImmutableDictionary
<
ProjectId
,
ImmutableHashSet
<
ProjectId
>>
existingReverseReferencesMap
,
ImmutableDictionary
<
ProjectId
,
ImmutableHashSet
<
ProjectId
>>
?
existingReverseReferencesMap
,
ProjectId
projectId
,
ProjectId
projectId
,
ProjectId
referencedProjectId
)
ProjectId
referencedProjectId
)
{
{
if
(
existingReverseReferencesMap
is
null
)
return
null
;
if
(
existingReverseReferencesMap
.
TryGetValue
(
referencedProjectId
,
out
var
referencingProjects
))
if
(
existingReverseReferencesMap
.
TryGetValue
(
referencedProjectId
,
out
var
referencingProjects
))
{
{
return
existingReverseReferencesMap
.
SetItem
(
referencedProjectId
,
referencingProjects
.
Remove
(
projectId
));
return
existingReverseReferencesMap
.
SetItem
(
referencedProjectId
,
referencingProjects
.
Remove
(
projectId
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录