예제 #1
0
 internal FieldInfo GetMissingFieldOrThrow(Type declaringType, string name, FieldSignature signature)
 {
     if (resolveMissingMembers)
     {
         return(new MissingField(declaringType, name, signature));
     }
     throw new MissingFieldException(declaringType.ToString(), name);
 }
예제 #2
0
        public override bool Equals(object obj)
        {
            FieldSignature other = obj as FieldSignature;

            return(other != null &&
                   other.fieldType.Equals(fieldType) &&
                   other.mods.Equals(mods));
        }
        public override bool Equals(object obj)
        {
            FieldSignature other = obj as FieldSignature;

            return(other != null &&
                   other.fieldType.Equals(fieldType) &&
                   Util.ArrayEquals(other.optionalCustomModifiers, optionalCustomModifiers) &&
                   Util.ArrayEquals(other.requiredCustomModifiers, requiredCustomModifiers));
        }
예제 #4
0
        private static void AddNamedArgument(List <CustomAttributeNamedArgument> list, Type attributeType, string fieldName, Type valueType, object value)
        {
            // some fields are not available on the .NET Compact Framework version of DllImportAttribute/MarshalAsAttribute
            FieldInfo field = attributeType.FindField(fieldName, FieldSignature.Create(valueType, new CustomModifiers()));

            if (field != null)
            {
                list.Add(new CustomAttributeNamedArgument(field, new CustomAttributeTypedArgument(valueType, value)));
            }
        }
예제 #5
0
        private static FieldInfo GetField(Type type, string name, Type fieldType)
        {
            Type org = type;

            for (; type != null && !type.__IsMissing; type = type.BaseType)
            {
                foreach (FieldInfo field in type.__GetDeclaredFields())
                {
                    if (field.IsPublic && !field.IsStatic && field.Name == name)
                    {
                        return(field);
                    }
                }
            }
            // if the field is missing, we stick the missing field on the first missing base type
            if (type == null)
            {
                type = org;
            }
            FieldSignature sig = FieldSignature.Create(fieldType, new CustomModifiers());

            return(type.FindField(name, sig)
                   ?? type.Module.universe.GetMissingFieldOrThrow(type, name, sig));
        }
예제 #6
0
파일: Type.cs 프로젝트: ngraziano/mono
		internal virtual FieldInfo FindField(string name, FieldSignature signature)
		{
			foreach (FieldInfo field in __GetDeclaredFields())
			{
				if (field.Name == name && field.FieldSignature.Equals(signature))
				{
					return field;
				}
			}
			return null;
		}
예제 #7
0
 internal override FieldInfo FindField(string name, FieldSignature signature)
 {
     return(new MissingField(this, name, signature));
 }
예제 #8
0
 internal MissingField(Type declaringType, string name, FieldSignature signature)
 {
     this.declaringType = declaringType;
     this.name          = name;
     this.signature     = signature;
 }
예제 #9
0
파일: Missing.cs 프로젝트: Semogj/ikvm-fork
		internal override FieldInfo FindField(string name, FieldSignature signature)
		{
			return new MissingField(this, name, signature);
		}
예제 #10
0
파일: Missing.cs 프로젝트: Semogj/ikvm-fork
		internal MissingField(Type declaringType, string name, FieldSignature signature)
		{
			this.declaringType = declaringType;
			this.name = name;
			this.signature = signature;
		}
예제 #11
0
 internal FieldInfo GetMissingFieldOrThrow(Module requester, Type declaringType, string name, FieldSignature signature)
 {
     if (resolveMissingMembers)
     {
         FieldInfo field = new MissingField(declaringType, name, signature);
         if (ResolvedMissingMember != null)
         {
             ResolvedMissingMember(requester, field);
         }
         return(field);
     }
     throw new MissingFieldException(declaringType.ToString(), name);
 }