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); }
private static PropertyInfo GetProperty(Module context, 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(context, type, name, PropertySignature.Create(CallingConventions.Standard | CallingConventions.HasThis, propertyType, null, new PackedCustomModifiers()))); }
internal MissingProperty(Type declaringType, string name, PropertySignature signature) { this.declaringType = declaringType; this.name = name; this.signature = signature; }
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); } throw new System.MissingMemberException(declaringType.ToString() + "." + name); }