提交 0e837e43 编写于 作者: V Victor Zaytsev

Fixed review notes.

上级 a2b857fa
......@@ -641,8 +641,7 @@ public static bool CanSupportCollectionInitializer(this ITypeSymbol typeSymbol,
typeSymbol.AllInterfaces.Any(i => i.SpecialType == SpecialType.System_Collections_IEnumerable) &&
typeSymbol.GetBaseTypesAndThis()
.Union(typeSymbol.GetOriginalInterfacesAndTheirBaseInterfaces())
.SelectAccessibleMembers<IMethodSymbol>(within ?? typeSymbol)
.Where(s => s.Name == WellKnownMemberNames.CollectionInitializerAddMethodName)
.SelectAccessibleMembers<IMethodSymbol>(WellKnownMemberNames.CollectionInitializerAddMethodName, within ?? typeSymbol)
.OfType<IMethodSymbol>()
.Any(m => m.Parameters.Any());
}
......@@ -733,6 +732,16 @@ public static INamedTypeSymbol GetDelegateType(this ITypeSymbol typeSymbol, Comp
return types.SelectMany(x => x.GetMembers().OfType<T>().Where(m => m.IsAccessibleWithin(within)));
}
private static IEnumerable<T> SelectAccessibleMembers<T>(this IEnumerable<ITypeSymbol> types, string memberName, ISymbol within) where T : class, ISymbol
{
if (types == null)
{
return ImmutableArray<T>.Empty;
}
return types.SelectMany(x => x.GetMembers(memberName).OfType<T>().Where(m => m.IsAccessibleWithin(within)));
}
private static bool? IsMoreSpecificThan(this ITypeSymbol t1, ITypeSymbol t2)
{
// SPEC: A type parameter is less specific than a non-type parameter.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册