Пример #1
0
        public bool Equals(MemberReference lhs, MemberReference rhs, ITypeInfoSource typeInfo)
        {
            if ((lhs == null) || (rhs == null))
            {
                return(lhs == rhs);
            }

            if (lhs == rhs)
            {
                return(true);
            }

            var declaringType = rhs.DeclaringType.Resolve();

            if (declaringType == null)
            {
                return(false);
            }

            var rhsType = new TypeIdentifier(declaringType);

            if (!Type.Equals(rhsType))
            {
                return(false);
            }

            var rhsMember = MemberIdentifier.New(typeInfo, rhs);

            return(Member.Equals(rhsMember, typeInfo));
        }
Пример #2
0
        public bool Equals(MemberIdentifier rhs, ITypeInfoSource typeInfo)
        {
            /*
             * if (this == rhs)
             *  return true;
             */

            if (IsStatic != rhs.IsStatic)
            {
                return(false);
            }

            if (Type != rhs.Type)
            {
                return(false);
            }

            if (GenericArgumentCount != rhs.GenericArgumentCount)
            {
                return(false);
            }

            if (!String.Equals(Name, rhs.Name))
            {
                return(false);
            }

            if (!TypesAreEqual(typeInfo, ReturnType, rhs.ReturnType))
            {
                return(false);
            }

            if ((ParameterTypes == AnyParameterTypes) || (rhs.ParameterTypes == AnyParameterTypes))
            {
            }
            else if ((ParameterTypes == null) || (rhs.ParameterTypes == null))
            {
                if (ParameterTypes != rhs.ParameterTypes)
                {
                    return(false);
                }
            }
            else
            {
                if (ParameterTypes.Length != rhs.ParameterTypes.Length)
                {
                    return(false);
                }

                for (int i = 0, c = ParameterTypes.Length; i < c; i++)
                {
                    if (!TypesAreEqual(typeInfo, ParameterTypes[i], rhs.ParameterTypes[i]))
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }
Пример #3
0
        public bool Equals(MethodSignature rhs)
        {
            if (this == rhs)
            {
                return(true);
            }

            if (GenericParameterCount != rhs.GenericParameterCount)
            {
                return(false);
            }

            var pc = ParameterCount;

            if (pc != rhs.ParameterCount)
            {
                return(false);
            }

            for (int i = 0, c = GenericParameterCount; i < c; i++)
            {
                if (GenericParameterNames[i] != rhs.GenericParameterNames[i])
                {
                    return(false);
                }
            }

            if (!MemberIdentifier.TypesAreEqual(TypeInfo, ReturnType, rhs.ReturnType))
            {
                return(false);
            }

            for (int i = 0, c = pc; i < c; i++)
            {
                if (!MemberIdentifier.TypesAreEqual(TypeInfo, ParameterTypes[i], rhs.ParameterTypes[i]))
                {
                    return(false);
                }
            }

            return(true);
        }
Пример #4
0
 public QualifiedMemberIdentifier(TypeIdentifier type, MemberIdentifier member)
 {
     Type   = type;
     Member = member;
 }