Esempio n. 1
0
        private void WritePrivateConstructor(ITypeDefinition type)
        {
            if (!_forCompilation ||
                type.IsInterface ||
                type.IsEnum ||
                type.IsDelegate ||
                type.IsValueType ||
                type.IsStatic)
            {
                return;
            }

            var visibility = Filter switch
            {
                IncludeAllFilter _ => TypeMemberVisibility.Private,
                InternalsAndPublicCciFilter _ => TypeMemberVisibility.Private,
                IntersectionFilter intersection => intersection.Filters.Any(
                    f => f is IncludeAllFilter || f is InternalsAndPublicCciFilter) ?
                TypeMemberVisibility.Private :
                TypeMemberVisibility.Assembly,
                _ => TypeMemberVisibility.Assembly
            };

            WriteVisibility(visibility);
            if (IsBaseConstructorCallUnsafe(type))
            {
                WriteKeyword("unsafe");
            }

            WriteIdentifier(((INamedEntity)type).Name);
            WriteSymbol("(");
            WriteSymbol(")");
            WriteBaseConstructorCall(type);
            WriteEmptyBody();
        }
Esempio n. 2
0
        private static ICciFilter GetFilter(string apiList, bool all, bool apiOnly, string excludeApiList, bool excludeMembers, string excludeAttributesList)
        {
            ICciFilter includeFilter = null;

            if (string.IsNullOrWhiteSpace(apiList))
            {
                if (all)
                {
                    includeFilter = new IncludeAllFilter();
                }
                else
                {
                    includeFilter = new PublicOnlyCciFilter(excludeAttributes: apiOnly);
                }
            }
            else
            {
                includeFilter = new DocIdIncludeListFilter(apiList);
            }

            if (!string.IsNullOrWhiteSpace(excludeApiList))
            {
                includeFilter = new IntersectionFilter(includeFilter, new DocIdExcludeListFilter(excludeApiList, excludeMembers));
            }

            if (!string.IsNullOrWhiteSpace(excludeAttributesList))
            {
                includeFilter = new IntersectionFilter(includeFilter, new ExcludeAttributesFilter(excludeAttributesList));
            }

            return(includeFilter);
        }
Esempio n. 3
0
        private static ICciFilter GetFilter()
        {
            ICciFilter includeFilter = null;

            if (string.IsNullOrWhiteSpace(s_apiList))
            {
                if (s_all)
                {
                    includeFilter = new IncludeAllFilter();
                }
                else
                {
                    includeFilter = new PublicOnlyCciFilter(excludeAttributes: s_apiOnly);
                }
            }
            else
            {
                includeFilter = new DocIdIncludeListFilter(s_apiList);
            }

            if (!string.IsNullOrWhiteSpace(s_excludeApiList))
            {
                includeFilter = new IntersectionFilter(includeFilter, new DocIdExcludeListFilter(s_excludeApiList));
            }

            if (!string.IsNullOrWhiteSpace(s_excludeAttributesList))
            {
                includeFilter = new IntersectionFilter(includeFilter, new ExcludeAttributesFilter(s_excludeAttributesList));
            }

            return(includeFilter);
        }
Esempio n. 4
0
        private static ICciFilter GetFilter(
            string apiList,
            bool all,
            bool includeInternals,
            bool apiOnly,
            bool excludeCompilerGenerated,
            string excludeApiList,
            bool excludeMembers,
            string excludeAttributesList,
            bool includeForwardedTypes)
        {
            ICciFilter includeFilter;

            if (!string.IsNullOrWhiteSpace(apiList))
            {
                includeFilter = new DocIdIncludeListFilter(apiList);
            }
            else if (all)
            {
                includeFilter = new IncludeAllFilter();
            }
            else if (includeInternals)
            {
                includeFilter = new InternalsAndPublicCciFilter(excludeAttributes: apiOnly, includeForwardedTypes);
            }
            else
            {
                includeFilter = new PublicOnlyCciFilter(excludeAttributes: apiOnly, includeForwardedTypes);
            }

            if (excludeCompilerGenerated)
            {
                includeFilter = new IntersectionFilter(includeFilter, new ExcludeCompilerGeneratedCciFilter());
            }

            if (!string.IsNullOrWhiteSpace(excludeApiList))
            {
                includeFilter = new IntersectionFilter(includeFilter, new DocIdExcludeListFilter(excludeApiList, excludeMembers));
            }

            if (!string.IsNullOrWhiteSpace(excludeAttributesList))
            {
                includeFilter = new IntersectionFilter(includeFilter, new ExcludeAttributesFilter(excludeAttributesList));
            }

            return(includeFilter);
        }