提交 9cb83be2 编写于 作者: S Sam Harwell

Update signatures and comment for clarity

上级 fe06d371
......@@ -1697,6 +1697,7 @@ private void ConvertProjectReferencesToMetadataReferences_NoLock(ProjectId proje
{
var referenceInfo = GetReferenceInfo_NoLock(projectIdToRetarget);
// Update ConvertedProjectReferences in place to avoid duplicate list allocations
for (var i = 0; i < referenceInfo.ConvertedProjectReferences.Count; i++)
{
var convertedReference = referenceInfo.ConvertedProjectReferences[i];
......
......@@ -1821,31 +1821,31 @@ public ImmutableArray<DocumentId> GetDocumentIdsWithFilePath(string? filePath)
continue;
}
builder.Add(id, CanReuse() ? tracker : tracker.Fork(tracker.ProjectState));
builder.Add(id, CanReuse(id) ? tracker : tracker.Fork(tracker.ProjectState));
}
// Returns true if 'tracker' can be reused for project 'id'
bool CanReuse()
{
if (id == projectId)
return true;
return builder.ToImmutable();
// Check the dependency graph to see if project 'id' directly or transitively depends on 'projectId'.
// If the information is not available, do not compute it.
var forwardDependencies = dependencyGraph.TryGetProjectsThatThisProjectTransitivelyDependsOn(id);
if (forwardDependencies is object && !forwardDependencies.Contains(projectId))
{
return true;
}
// Returns true if 'tracker' can be reused for project 'id'
bool CanReuse(ProjectId id)
{
if (id == projectId)
return true;
// Compute the set of all projects that depend on 'projectId'. This information answers the same
// question as the previous check, but involves at most one transitive computation within the
// dependency graph.
dependencies ??= dependencyGraph.GetProjectsThatTransitivelyDependOnThisProject(projectId);
return !dependencies.Contains(id);
// Check the dependency graph to see if project 'id' directly or transitively depends on 'projectId'.
// If the information is not available, do not compute it.
var forwardDependencies = dependencyGraph.TryGetProjectsThatThisProjectTransitivelyDependsOn(id);
if (forwardDependencies is object && !forwardDependencies.Contains(projectId))
{
return true;
}
}
return builder.ToImmutable();
// Compute the set of all projects that depend on 'projectId'. This information answers the same
// question as the previous check, but involves at most one transitive computation within the
// dependency graph.
dependencies ??= dependencyGraph.GetProjectsThatTransitivelyDependOnThisProject(projectId);
return !dependencies.Contains(id);
}
}
/// <summary>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册