Esempio n. 1
0
        public IEnumerable <NamespaceDeclarationSyntax> Create(ICompilation compilation)
        {
            IEnumerable <(ITypeDefinition typeDefinition, bool isAbstract, IEnumerable <IMethod> methods)> values = compilation.GetPublicTypeDefinitions()
                                                                                                                    .Where(
                x => x.Kind != TypeKind.Interface &&
                (!IsMulticastDelegateDerived(x) ||
                 !x.DirectBaseTypes.Any()) &&
                !_garbageTypeList.Any(y => x.FullName.Contains(y)) &&
                CocoaDelegateNames.Any(cocoaName => x.FullName.EndsWith(cocoaName, StringComparison.OrdinalIgnoreCase)))
                                                                                                                    .Select(typeDef => new { TypeDefinition = typeDef, IsAbstract = typeDef.Methods.Any(method => method.ReturnType.FullName != RoslynHelpers.VoidType && method.IsAbstract) })
                                                                                                                    .Select(x => (x.TypeDefinition, x.IsAbstract, GetPublicDelegateMethods(x.TypeDefinition)))
                                                                                                                    .Where(x => x.Item3.Any());

            return(DelegateGenerator.Generate(values));
        }