Esempio n. 1
0
		internal virtual MethodBase FindMethod(string name, MethodSignature signature)
		{
			foreach (MethodBase method in __GetDeclaredMethods())
			{
				if (method.Name == name && method.MethodSignature.Equals(signature))
				{
					return method;
				}
			}
			return null;
		}
Esempio n. 2
0
		public MethodBase __CreateMissingMethod(string name, CallingConventions callingConvention, Type returnType, Type[] returnTypeRequiredCustomModifiers, Type[] returnTypeOptionalCustomModifiers, Type[] parameterTypes, Type[][] parameterTypeRequiredCustomModifiers, Type[][] parameterTypeOptionalCustomModifiers)
		{
			MethodSignature sig = new MethodSignature(
				returnType ?? this.Module.universe.System_Void,
				Util.Copy(parameterTypes),
				PackedCustomModifiers.CreateFromExternal(returnTypeOptionalCustomModifiers, returnTypeRequiredCustomModifiers, parameterTypeOptionalCustomModifiers, parameterTypeRequiredCustomModifiers, parameterTypes.Length),
				callingConvention,
				0);
			MethodInfo method = new MissingMethod(this, name, sig);
			if (name == ".ctor" || name == ".cctor")
			{
				return new ConstructorInfoImpl(method);
			}
			return method;
		}
Esempio n. 3
0
		internal override MethodBase FindMethod(string name, MethodSignature signature)
		{
			MethodInfo method = new MissingMethod(this, name, signature);
			if (name == ".ctor")
			{
				return new ConstructorInfoImpl(method);
			}
			return method;
		}
Esempio n. 4
0
		internal MissingMethod(Type declaringType, string name, MethodSignature signature)
		{
			this.declaringType = declaringType;
			this.name = name;
			this.signature = signature;
		}
		private static List<CustomAttributeTypedArgument> WrapConstructorArgs(object[] args, MethodSignature sig)
		{
			List<CustomAttributeTypedArgument> list = new List<CustomAttributeTypedArgument>();
			for (int i = 0; i < args.Length; i++)
			{
				list.Add(new CustomAttributeTypedArgument(sig.GetParameterType(i), args[i]));
			}
			return list;
		}
		internal bool MatchParameterTypes(MethodSignature other)
		{
			return Util.ArrayEquals(other.parameterTypes, parameterTypes);
		}
		private static int MatchSignatures(MethodSignature sig1, MethodSignature sig2, Type[] types)
		{
			for (int i = 0; i < sig1.GetParameterCount(); i++)
			{
				Type type1 = sig1.GetParameterType(i);
				Type type2 = sig2.GetParameterType(i);
				if (type1 != type2)
				{
					return MatchTypes(type1, type2, types[i]);
				}
			}
			return 0;
		}
Esempio n. 8
0
File: Type.cs Progetto: nestalk/mono
		private MethodBase CreateMissingMethod(string name, CallingConventions callingConvention, Type returnType, Type[] parameterTypes, PackedCustomModifiers customModifiers)
		{
			MethodSignature sig = new MethodSignature(
				returnType ?? this.Module.universe.System_Void,
				Util.Copy(parameterTypes),
				customModifiers,
				callingConvention,
				0);
			MethodInfo method = new MissingMethod(this, name, sig);
			if (name == ".ctor" || name == ".cctor")
			{
				return new ConstructorInfoImpl(method);
			}
			return method;
		}
Esempio n. 9
0
 internal MissingMethod(Type declaringType, string name, MethodSignature signature)
 {
     this.declaringType = declaringType;
     this.name          = name;
     this.signature     = signature;
 }
Esempio n. 10
0
        internal MethodBase GetMissingMethodOrThrow(Module requester, Type declaringType, string name, MethodSignature signature)
        {
            if (resolveMissingMembers)
            {
                MethodBase method = new MissingMethod(declaringType, name, signature);
                if (name == ".ctor")
                {
                    method = new ConstructorInfoImpl((MethodInfo)method);
                }
                if (ResolvedMissingMember != null)
                {
                    ResolvedMissingMember(requester, method);
                }
                return(method);
            }
#if CORECLR
            throw new MissingMethodException(declaringType.ToString() + "." + name);
#else
            throw new MissingMethodException(declaringType.ToString(), name);
#endif
        }
Esempio n. 11
0
        private static List <CustomAttributeTypedArgument> WrapConstructorArgs(object[] args, MethodSignature sig)
        {
            List <CustomAttributeTypedArgument> list = new List <CustomAttributeTypedArgument>();

            for (int i = 0; i < args.Length; i++)
            {
                list.Add(new CustomAttributeTypedArgument(sig.GetParameterType(i), args[i]));
            }
            return(list);
        }