Example #1
0
 private static int MatchSignatures(PropertySignature sig1, PropertySignature sig2, Type[] types)
 {
     for (int i = 0; i < sig1.ParameterCount; i++)
     {
         Type type1 = sig1.GetParameter(i);
         Type type2 = sig2.GetParameter(i);
         if (type1 != type2)
         {
             return(MatchTypes(type1, type2, types[i]));
         }
     }
     return(0);
 }
Example #2
0
        private static PropertyInfo GetProperty(Type type, string name, Type propertyType)
        {
            Type org = type;

            for (; type != null && !type.__IsMissing; type = type.BaseType)
            {
                foreach (PropertyInfo property in type.__GetDeclaredProperties())
                {
                    if (property.IsPublic && !property.IsStatic && property.Name == name)
                    {
                        return(property);
                    }
                }
            }
            // if the property is missing, we stick the missing property on the first missing base type
            if (type == null)
            {
                type = org;
            }
            return(type.Module.universe.GetMissingPropertyOrThrow(type, name, PropertySignature.Create(CallingConventions.Standard | CallingConventions.HasThis, propertyType, null, new PackedCustomModifiers())));
        }
Example #3
0
 internal PropertyInfo GetMissingPropertyOrThrow(Type declaringType, string name, PropertySignature propertySignature)
 {
     // HACK we need to check __IsMissing here, because Type doesn't have a FindProperty API
     // since properties are never resolved, except by custom attributes
     if (resolveMissingMembers || declaringType.__IsMissing)
     {
         return(new MissingProperty(declaringType, name, propertySignature));
     }
     throw new System.MissingMemberException(declaringType.ToString(), name);
 }
Example #4
0
 internal MissingProperty(Type declaringType, string name, PropertySignature signature)
 {
     this.declaringType = declaringType;
     this.name          = name;
     this.signature     = signature;
 }
Example #5
0
		internal MissingProperty(Type declaringType, string name, PropertySignature signature)
		{
			this.declaringType = declaringType;
			this.name = name;
			this.signature = signature;
		}
		private static int MatchSignatures(PropertySignature sig1, PropertySignature sig2, Type[] types)
		{
			for (int i = 0; i < sig1.ParameterCount; i++)
			{
				Type type1 = sig1.GetParameter(i);
				Type type2 = sig2.GetParameter(i);
				if (type1 != type2)
				{
					return MatchTypes(type1, type2, types[i]);
				}
			}
			return 0;
		}
Example #7
0
        internal PropertyInfo GetMissingPropertyOrThrow(Module requester, Type declaringType, string name, PropertySignature propertySignature)
        {
            // HACK we need to check __IsMissing here, because Type doesn't have a FindProperty API
            // since properties are never resolved, except by custom attributes
            if (resolveMissingMembers || declaringType.__IsMissing)
            {
                PropertyInfo property = new MissingProperty(declaringType, name, propertySignature);
                if (ResolvedMissingMember != null && !declaringType.__IsMissing)
                {
                    ResolvedMissingMember(requester, property);
                }
                return(property);
            }
#if CORECLR
            throw new System.MissingMemberException(declaringType.ToString() + "." + name);
#else
            throw new System.MissingMemberException(declaringType.ToString(), name);
#endif
        }