Esempio n. 1
0
        private void CheckValidExtension(Method node)
        {
            var method = GetEntity(node);

            if (!method.IsExtension)
            {
                return;
            }

            var extendedType = method.GetParameters()[0].Type;
            var entity       = NameResolutionService.Resolve(extendedType, method.Name, EntityType.Method);

            if (entity == null)
            {
                return;
            }

            var conflicting = FindConflictingMember(method, entity);

            if (conflicting == null || !conflicting.IsPublic)
            {
                return;
            }

            Error(CompilerErrorFactory.MemberNameConflict(node, extendedType, TypeSystemServices.GetSignature(conflicting)));
        }
        private string GetAbstractMemberSignature(IMember member)
        {
            IMethod method = member as IMethod;

            return(method != null
                                ? TypeSystemServices.GetSignature(method)
                                : member.FullName);
        }
Esempio n. 3
0
        protected void CheckOverloadableMember(List <TypeMember> existing, TypeMember member)
        {
            var expectedNodeType = member.NodeType;

            foreach (TypeMember existingMember in existing)
            {
                if (expectedNodeType != existingMember.NodeType)
                {
                    MemberNameConflict(member);
                }
                else
                {
                    if (expectedNodeType == NodeType.Constructor && existingMember.IsStatic != member.IsStatic)
                    {
                        continue;                         // only check instance constructors against each other
                    }
                    if (IsConflictingOverload(member, existingMember))
                    {
                        MemberConflict(member, TypeSystemServices.GetSignature((IEntityWithParameters)member.Entity, false));
                    }
                }
            }
        }
Esempio n. 4
0
        protected void CheckOverloadableMember(List existing, TypeMember member)
        {
            NodeType expectedNodeType = member.NodeType;

            foreach (TypeMember existingMember in existing)
            {
                if (expectedNodeType != existingMember.NodeType)
                {
                    MemberNameConflict(member);
                }
                else
                {
                    if (existingMember.IsStatic == member.IsStatic)
                    {
                        if (AreParametersTheSame(existingMember, member) &&
                            !AreDifferentInterfaceMembers((IExplicitMember)existingMember, (IExplicitMember)member))
                        {
                            MemberConflict(member, TypeSystemServices.GetSignature((IEntityWithParameters)member.Entity, false));
                        }
                    }
                }
            }
        }
Esempio n. 5
0
        private void CheckValidExtension(Method node)
        {
            IMethod method = GetEntity(node);

            if (!method.IsExtension)
            {
                return;
            }

            IType   extendedType = method.GetParameters()[0].Type;
            IEntity entity       = NameResolutionService.Resolve(extendedType, method.Name, EntityType.Method);

            if (null == entity)
            {
                return;
            }
            IMethod conflicting = FindConflictingMember(method, entity);

            if (null == conflicting || !conflicting.IsPublic)
            {
                return;
            }

            Error(CompilerErrorFactory.MemberNameConflict(node, extendedType.ToString(), TypeSystemServices.GetSignature(conflicting, false)));
        }
Esempio n. 6
0
 override public string ToString()
 {
     return(TypeSystemServices.GetSignature(this));
 }