Beispiel #1
0
        public override MethodInfo GetBaseDefinition()
        {
            if (!IsVirtual || IsStatic || m_declaringType == null || m_declaringType.IsInterface)
            {
                return(this);
            }

            int         slot              = RuntimeMethodHandle.GetSlot(this);
            RuntimeType declaringType     = (RuntimeType)DeclaringType;
            RuntimeType baseDeclaringType = declaringType;
            RuntimeMethodHandleInternal baseMethodHandle = new RuntimeMethodHandleInternal();

            do
            {
                int cVtblSlots = RuntimeTypeHandle.GetNumVirtuals(declaringType);

                if (cVtblSlots <= slot)
                {
                    break;
                }

                baseMethodHandle  = RuntimeTypeHandle.GetMethodAt(declaringType, slot);
                baseDeclaringType = declaringType;

                declaringType = (RuntimeType)declaringType.BaseType;
            } while (declaringType != null);

            return((MethodInfo)RuntimeType.GetMethodBase(baseDeclaringType, baseMethodHandle));
        }
Beispiel #2
0
        [System.Security.SecuritySafeCritical]  // auto-generated
        internal RuntimeMethodInfo GetParentDefinition()
        {
            if (!IsVirtual || m_declaringType.IsInterface)
                return null;

            RuntimeType parent = (RuntimeType)m_declaringType.BaseType;

            if (parent == null)
                return null;

            int slot = RuntimeMethodHandle.GetSlot(this);

            if (RuntimeTypeHandle.GetNumVirtuals(parent) <= slot)
                return null;

            return (RuntimeMethodInfo)RuntimeType.GetMethodBase(parent, RuntimeTypeHandle.GetMethodAt(parent, slot));
        }
Beispiel #3
0
        internal RuntimeMethodInfo GetParentDefinition()
        {
            if (!base.IsVirtual || this.m_declaringType.IsInterface)
            {
                return(null);
            }
            RuntimeType baseType = (RuntimeType)this.m_declaringType.BaseType;

            if (baseType == null)
            {
                return(null);
            }
            int slot = RuntimeMethodHandle.GetSlot(this);

            if (RuntimeTypeHandle.GetNumVirtuals(baseType) <= slot)
            {
                return(null);
            }
            return((RuntimeMethodInfo)RuntimeType.GetMethodBase(baseType, RuntimeTypeHandle.GetMethodAt(baseType, slot)));
        }
        internal RuntimeMethodInfo?GetParentDefinition()
        {
            if (!IsVirtual || m_declaringType.IsInterface)
            {
                return(null);
            }

            RuntimeType?parent = (RuntimeType?)m_declaringType.BaseType;

            if (parent == null)
            {
                return(null);
            }

            int slot = RuntimeMethodHandle.GetSlot(this);

            if (RuntimeTypeHandle.GetNumVirtuals(parent) <= slot)
            {
                return(null);
            }

            return((RuntimeMethodInfo?)RuntimeType.GetMethodBase(parent, RuntimeTypeHandle.GetMethodAt(parent, slot)));
        }
Beispiel #5
0
        public override MethodInfo GetBaseDefinition()
        {
            if ((!base.IsVirtual || base.IsStatic) || ((this.m_declaringType == null) || this.m_declaringType.IsInterface))
            {
                return(this);
            }
            int         slot          = RuntimeMethodHandle.GetSlot(this);
            RuntimeType declaringType = (RuntimeType)this.DeclaringType;
            RuntimeType reflectedType = declaringType;
            RuntimeMethodHandleInternal methodHandle = new RuntimeMethodHandleInternal();

            do
            {
                if (RuntimeTypeHandle.GetNumVirtuals(declaringType) <= slot)
                {
                    break;
                }
                methodHandle  = RuntimeTypeHandle.GetMethodAt(declaringType, slot);
                reflectedType = declaringType;
                declaringType = (RuntimeType)declaringType.BaseType;
            }while (declaringType != null);
            return((MethodInfo)RuntimeType.GetMethodBase(reflectedType, methodHandle));
        }
Beispiel #6
0
        public override MethodInfo GetBaseDefinition()
        {
            if (!this.IsVirtual || this.IsStatic || (this.m_declaringType == (RuntimeType)null || this.m_declaringType.IsInterface))
            {
                return((MethodInfo)this);
            }
            int         slot          = RuntimeMethodHandle.GetSlot((IRuntimeMethodInfo)this);
            RuntimeType type          = (RuntimeType)this.DeclaringType;
            RuntimeType reflectedType = type;
            RuntimeMethodHandleInternal methodHandle = new RuntimeMethodHandleInternal();

            while (RuntimeTypeHandle.GetNumVirtuals(type) > slot)
            {
                methodHandle  = RuntimeTypeHandle.GetMethodAt(type, slot);
                reflectedType = type;
                type          = (RuntimeType)type.BaseType;
                if (!(type != (RuntimeType)null))
                {
                    break;
                }
            }
            return((MethodInfo)RuntimeType.GetMethodBase(reflectedType, methodHandle));
        }
Beispiel #7
0
        public override MethodInfo GetBaseDefinition()
        {
            if (!base.IsVirtual || base.IsStatic || this.m_declaringType == null || this.m_declaringType.IsInterface)
            {
                return(this);
            }
            int         slot          = RuntimeMethodHandle.GetSlot(this);
            RuntimeType runtimeType   = (RuntimeType)this.DeclaringType;
            RuntimeType reflectedType = runtimeType;
            RuntimeMethodHandleInternal methodHandle = default(RuntimeMethodHandleInternal);

            do
            {
                int numVirtuals = RuntimeTypeHandle.GetNumVirtuals(runtimeType);
                if (numVirtuals <= slot)
                {
                    break;
                }
                methodHandle  = RuntimeTypeHandle.GetMethodAt(runtimeType, slot);
                reflectedType = runtimeType;
                runtimeType   = (RuntimeType)runtimeType.BaseType;
            }while (runtimeType != null);
            return((MethodInfo)RuntimeType.GetMethodBase(reflectedType, methodHandle));
        }
Beispiel #8
0
        public override MethodInfo GetBaseDefinition()
        {
            if ((!base.IsVirtual || base.IsStatic) || ((this.m_declaringType == null) || this.m_declaringType.IsInterface))
            {
                return(this);
            }
            int  slot          = this.m_handle.GetSlot();
            Type declaringType = this.DeclaringType;
            Type type2         = this.DeclaringType;
            RuntimeMethodHandle methodHandle = new RuntimeMethodHandle();

            do
            {
                RuntimeTypeHandle typeHandleInternal = declaringType.GetTypeHandleInternal();
                if (typeHandleInternal.GetNumVirtuals() <= slot)
                {
                    break;
                }
                methodHandle  = typeHandleInternal.GetMethodAt(slot);
                type2         = declaringType;
                declaringType = declaringType.BaseType;
            }while (declaringType != null);
            return((MethodInfo)RuntimeType.GetMethodBase(type2.GetTypeHandleInternal(), methodHandle));
        }