提交 2fe4a1f4 编写于 作者: C CyrusNajmabadi

Cache delegates to prevent allocations.

上级 bf475922
......@@ -109,9 +109,15 @@ public static Task<SyntaxTreeIdentifierInfo> GetIdentifierInfoAsync(Document doc
return GetInfoAsync(document, s_identifierSnapshotCache, SyntaxTreeIdentifierInfo.LoadAsync, tuple => tuple.Item1, cancellationToken);
}
public static Task<SyntaxTreeDeclarationInfo> GetDeclarationInfoAsync(Document document, CancellationToken cancellationToken)
private static Func<Document, CancellationToken, Task<SyntaxTreeDeclarationInfo>> s_loadAsync = SyntaxTreeDeclarationInfo.LoadAsync;
private static Func<ValueTuple<SyntaxTreeIdentifierInfo, SyntaxTreeContextInfo, SyntaxTreeDeclarationInfo>, SyntaxTreeDeclarationInfo> s_getThirdItem = tuple => tuple.Item3;
public static Task<SyntaxTreeDeclarationInfo> GetDeclarationInfoAsync(
Document document, CancellationToken cancellationToken)
{
return GetInfoAsync(document, s_declaredSymbolsSnapshotCache, SyntaxTreeDeclarationInfo.LoadAsync, tuple => tuple.Item3, cancellationToken);
return GetInfoAsync(
document, s_declaredSymbolsSnapshotCache, s_loadAsync,
s_getThirdItem, cancellationToken);
}
// The probability of getting a false positive when calling ContainsIdentifier.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册