提交 e133ca42 编写于 作者: C CyrusNajmabadi

Prevent N calls to get a syntax tree.

上级 013a882e
......@@ -323,8 +323,8 @@ private static void AddEnumMemberSpan(ISymbol symbol, SyntaxTree tree, List<Text
}
}
var location = symbol.Locations.FirstOrDefault(
l => l.SourceTree.Equals(document.GetSyntaxTreeSynchronously(cancellationToken)));
var syntaxTree = document.GetSyntaxTreeSynchronously(cancellationToken);
var location = symbol.Locations.FirstOrDefault(l => l.SourceTree.Equals(syntaxTree));
if (location == null)
{
......
......@@ -494,10 +494,8 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.NavigationBar
Dim sourceLocations = symbol.Locations.Where(Function(l) l.IsInSource)
' First figure out the location that we want to grab considering partial types
Dim location = sourceLocations.FirstOrDefault(
Function(l)
Return l.SourceTree.Equals(document.GetSyntaxTreeSynchronously(cancellationToken))
End Function)
Dim syntaxTree = document.GetSyntaxTreeSynchronously(cancellationToken)
Dim location = sourceLocations.FirstOrDefault(Function(l) l.SourceTree.Equals(syntaxTree))
If location Is Nothing Then
location = sourceLocations.FirstOrDefault
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册