Пример #1
0
        public virtual bool Include(ITypeDefinitionMember member)
        {
            switch (member.Visibility)
            {
            case TypeMemberVisibility.Public:
                return(true);

            case TypeMemberVisibility.Family:
            case TypeMemberVisibility.FamilyOrAssembly:
                // CCI's version of IsVisibleOutsideAssembly doesn't
                // consider protected members as being visible but for
                // our purposes which is to write CS files that can
                // be compiled we always need the protected members
                return(true);
            }

            if (!member.IsVisibleOutsideAssembly())
            {
                // If a type is public, abstract and has a public constructor,
                // then it must expose all abstract members.
                if (member.ContainingTypeDefinition.IsAbstract &&
                    member.IsAbstract() &&
                    member.ContainingTypeDefinition.IsConstructorVisible()
                    )
                {
                    return(true);
                }
                return(false);
            }

            return(true);
        }
Пример #2
0
 public override void Visit(ITypeDefinitionMember member)
 {
     if (member.IsVisibleOutsideAssembly())
     {
         base.Visit(member);
     }
 }
Пример #3
0
        public virtual bool Include(ITypeDefinitionMember member)
        {
            if (member == null)
                return false;

            if (!member.ContainingTypeDefinition.IsVisibleOutsideAssembly())
                return false;

            switch (member.Visibility)
            {
                case TypeMemberVisibility.Public:
                    return true;
                case TypeMemberVisibility.Family:
                case TypeMemberVisibility.FamilyOrAssembly:
                    // CCI's version of IsVisibleOutsideAssembly doesn't
                    // consider protected members as being visible but for
                    // our purposes which is to write CS files that can
                    // be compiled we always need the protected members
                    return true;
            }

            if (!member.IsVisibleOutsideAssembly())
                return false;

            return true;
        }
Пример #4
0
        public virtual bool Include(ITypeDefinitionMember member)
        {
            if (member == null)
            {
                return(false);
            }

            if (!member.ContainingTypeDefinition.IsVisibleOutsideAssembly())
            {
                return(false);
            }

            switch (member.Visibility)
            {
            case TypeMemberVisibility.Public:
                return(true);

            case TypeMemberVisibility.Family:
            case TypeMemberVisibility.FamilyOrAssembly:
                // CCI's version of IsVisibleOutsideAssembly doesn't
                // consider protected members as being visible but for
                // our purposes which is to write CS files that can
                // be compiled we always need the protected members
                return(true);
            }

            if (!member.IsVisibleOutsideAssembly())
            {
                return(false);
            }

            return(true);
        }
Пример #5
0
 public bool FilterMember(ITypeDefinitionMember member)
 {
     if (member.IsVisibleOutsideAssembly())
     {
         return(false);
     }
     return(true);
 }
Пример #6
0
        public override void Visit(ITypeDefinitionMember member)
        {
            if (TraverseExternallyVisibleOnly && !member.IsVisibleOutsideAssembly())
            {
                return;
            }

            base.Visit(member);
        }
Пример #7
0
        public bool Include(ITypeDefinitionMember member)
        {
            if (member == null || member is Dummy)
            {
                return(false);
            }

            if (!Include(member.ContainingTypeDefinition))
            {
                return(false);
            }

            if (!IncludeGenerated && IsCompilerGenerated(member))
            {
                // If it's an accessor, we want to fall-through.

                var propertyAccessors = from p in member.ContainingTypeDefinition.Properties
                                        from a in p.Accessors
                                        select a;

                var eventAccessors = from e in member.ContainingTypeDefinition.Events
                                     from a in e.Accessors
                                     select a;

                var accessors = propertyAccessors.Concat(eventAccessors);

                var isAccessor = (from a in accessors
                                  where a.ResolvedMethod == member
                                  select a).Any();

                if (!isAccessor)
                {
                    return(false);
                }
            }

            switch (member.Visibility)
            {
            case TypeMemberVisibility.Private:
                return(IncludePrivates || MemberHelper.IsVisibleOutsideAssembly(member));;

            case TypeMemberVisibility.Assembly:
            case TypeMemberVisibility.FamilyAndAssembly:
                return(IncludeInternals);

            case TypeMemberVisibility.Family:
            case TypeMemberVisibility.FamilyOrAssembly:
                return(true);

            case TypeMemberVisibility.Public:
                return(true);
            }

            return(member.IsVisibleOutsideAssembly());
        }
Пример #8
0
        private void ScanMember(ITypeDefinitionMember item)
        {
            if (!item.IsVisibleOutsideAssembly())
            {
                return;
            }

            var info = ScanPlatformNotSupported(item);

            _reporter.Report(info, item);
        }
        private void ScanMember(ITypeDefinitionMember item)
        {
            if (!item.IsVisibleOutsideAssembly() ||
                item is IPropertyDefinition ||
                item is IEventDefinition ||
                !_deprecatedTypeRegex.IsMatch(item.ContainingType.FullName()))
            {
                return;
            }

            if (IsDeprecated(item))
            {
                _reporter.Report(item);
            }
        }
Пример #10
0
        private void AddTypeReference(ITypeReference type)
        {
            Contract.Assert(type == type.UnWrap());

            if (_typePredicate(type))
            {
                IPropertyDefinition property = GetCurrent <IPropertyDefinition>();
                if (property != null)
                {
                    if (property.IsVisibleOutsideAssembly())
                    {
                        if (property.Getter != null)
                        {
                            _dependencies.Add(new TypeReferenceDependency(type, property.Getter.ResolvedTypeDefinitionMember));
                        }
                        if (property.Setter != null)
                        {
                            _dependencies.Add(new TypeReferenceDependency(type, property.Setter.ResolvedTypeDefinitionMember));
                        }
                    }
                }

                ITypeDefinitionMember member = GetCurrent <ITypeDefinitionMember>();
                if (member != null)
                {
                    if (member.IsVisibleOutsideAssembly())
                    {
                        _dependencies.Add(new TypeReferenceDependency(type, member));
                    }

                    return;
                }

                ITypeDefinition typeDef = GetCurrentType();
                if (typeDef != null)
                {
                    if (typeDef.IsVisibleOutsideAssembly())
                    {
                        _dependencies.Add(new TypeReferenceDependency(type, typeDef));
                    }
                    return;
                }
            }
        }
Пример #11
0
 public bool FilterMember(ITypeDefinitionMember member)
 {
     if (member.IsVisibleOutsideAssembly())
         return false;
     return true;
 }