提交 177f717e 编写于 作者: J Jason Malinowski 提交者: GitHub

Merge pull request #13353 from jasonmalinowski/port-fix-for-allocation-reduction

Don't allocate a lambda each time we get a hashcode for a named type
......@@ -169,7 +169,22 @@ private int CombineHashCodes(IModuleSymbol x, int currentHash)
private int CombineHashCodes(INamedTypeSymbol x, int currentHash)
{
return Unwrap(x).Aggregate(currentHash, (a, n) => CombineNamedTypeHashCode(n, a));
currentHash = CombineNamedTypeHashCode(x, currentHash);
var errorType = x as IErrorTypeSymbol;
if (errorType != null)
{
foreach (var candidate in errorType.CandidateSymbols)
{
var candidateNamedType = candidate as INamedTypeSymbol;
if (candidateNamedType != null)
{
currentHash = CombineNamedTypeHashCode(candidateNamedType, currentHash);
}
}
}
return currentHash;
}
private int CombineNamedTypeHashCode(INamedTypeSymbol x, int currentHash)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册