Inheritance: MemberReference, IGenericParametersProvider
Exemple #1
0
 public MethodImplementation(TypeDefinition @class, MethodReference methodDeclaration, MethodReference newMethod)
     : base(new MetaDataRow(@class.TableIndex, 0U, newMethod.TableIndex))
 {
     this._class = @class;
     this._methodDeclaration = methodDeclaration;
     this._methodBody = newMethod;
 }
Exemple #2
0
        public virtual MethodDefinition ResolveMethod(MethodReference methodRef)
        {
            var declaringType = ResolveType(methodRef.DeclaringType);
            methodRef = methodRef.GetElementMethod();

            if (declaringType != null && declaringType.HasMethods)
            {
                foreach (var method in declaringType.Methods)
                {
                    if (MethodRefsAreEqual(method, methodRef))
                    {
                        return method;
                    }
                }
            }

            return null;
        }
 public MethodSpecification(MethodReference methodRef)
 {
     OriginalMethod = methodRef;
 }
Exemple #4
0
        protected virtual bool MethodRefsAreEqual(MethodReference reference1, MethodReference reference2)
        {
            if (reference1 == null || reference2 == null)
                return false;
            if (!TypeRefsAreEqual(reference1.DeclaringType, reference2.DeclaringType))
                return false;
            if (reference1.Name != reference2.Name)
                return false;
            if (reference1.Signature == null || reference2.Signature == null)
                return false;
            if (!TypeRefsAreEqual(reference1.Signature.ReturnType, reference2.Signature.ReturnType))
                return false;
            if (reference1.Signature.HasParameters != reference2.Signature.HasParameters)
                return false;
            if (reference1.Signature.HasParameters && reference2.Signature.HasParameters)
            {
                if (reference1.Signature.Parameters.Length != reference2.Signature.Parameters.Length)
                    return false;

                for (int i = 0; i < reference1.Signature.Parameters.Length; i++)
                {
                    if (!TypeRefsAreEqual(reference1.Signature.Parameters[i].ParameterType, reference2.Signature.Parameters[i].ParameterType))
                    {
                        return false;
                    }
                }
            }
            if (reference1.HasGenericParameters && reference2.HasGenericParameters)
            {
                if (reference1.GenericParameters.Length != reference2.GenericParameters.Length)
                    return false;
            }
            return true;
        }
Exemple #5
0
 public override void LoadCache()
 {
     _class = Class;
     _methodBody = MethodBody;
     _methodDeclaration = MethodDeclaration;
 }
Exemple #6
0
 public override void ClearCache()
 {
     _class = null;
     _methodBody = null;
     _methodDeclaration = null;
 }
Exemple #7
0
 public override void ClearCache()
 {
     _parent = null;
     _constructor = null;
     _signature = null;
 }
Exemple #8
0
 public override void LoadCache()
 {
     _parent = Parent;
     _constructor = Constructor;
     _signature = Signature;
 }
Exemple #9
0
 public CustomAttribute(MetaDataMember parent, MethodReference constructor, uint value)
     : base(new MetaDataRow(0U,0U, value))
 {
     this._parent = parent;
     this._constructor = constructor;
 }
 public override void LoadCache()
 {
     _parent      = Parent;
     _constructor = Constructor;
     _signature   = Signature;
 }
 public override void ClearCache()
 {
     _parent      = null;
     _constructor = null;
     _signature   = null;
 }
 public CustomAttribute(MetaDataMember parent, MethodReference constructor, uint value)
     : base(new MetaDataRow(0U, 0U, value))
 {
     this._parent      = parent;
     this._constructor = constructor;
 }
Exemple #13
0
 public MethodSpecification(MethodReference methodRef)
     : base(default(MetaDataRow))
 {
     OriginalMethod = methodRef;
     _context = methodRef;
 }