提交 c38e4710 编写于 作者: C CyrusNajmabadi

Inline method.

上级 8535cf0b
......@@ -13,35 +13,6 @@ namespace Microsoft.CodeAnalysis.FindSymbols
{
public static partial class SymbolFinder
{
/// <summary>
/// Makes certain all namespace symbols returned by API are from the compilation.
/// </summary>
private static ImmutableArray<ISymbol> TranslateNamespaces(
ImmutableArray<ISymbol> symbols, Compilation compilation)
{
var builder = ArrayBuilder<ISymbol>.GetInstance();
foreach (var symbol in symbols)
{
var ns = symbol as INamespaceSymbol;
if (ns != null)
{
builder.Add(compilation.GetCompilationNamespace(ns));
}
else
{
builder.Add(symbol);
}
}
var result = builder.Count == symbols.Length
? symbols
: builder.ToImmutable();
builder.Free();
return result;
}
private static Task AddCompilationDeclarationsWithNormalQueryAsync(
Project project, SearchQuery query, SymbolFilter filter,
ArrayBuilder<ISymbol> list, CancellationToken cancellationToken)
......
......@@ -97,7 +97,17 @@ public static partial class SymbolFinder
}
}
return TranslateNamespaces(list.ToImmutableAndFree(), compilation);
// Make certain all namespace symbols returned by API are from the compilation.
for (var i = 0; i < list.Count; i++)
{
var symbol = list[i];
if (symbol is INamespaceSymbol ns)
{
list[i] = compilation.GetCompilationNamespace(ns);
}
}
return list.ToImmutableAndFree();
}
}
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册