Inheritance: MemberReference, IGenericParametersProvider
Exemplo n.º 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;
 }
Exemplo n.º 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;
        }
Exemplo n.º 3
0
 public MethodSpecification(MethodReference methodRef)
 {
     OriginalMethod = methodRef;
 }
Exemplo n.º 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;
        }
Exemplo n.º 5
0
 public override void LoadCache()
 {
     _class = Class;
     _methodBody = MethodBody;
     _methodDeclaration = MethodDeclaration;
 }
Exemplo n.º 6
0
 public override void ClearCache()
 {
     _class = null;
     _methodBody = null;
     _methodDeclaration = null;
 }
Exemplo n.º 7
0
 public override void ClearCache()
 {
     _parent = null;
     _constructor = null;
     _signature = null;
 }
Exemplo n.º 8
0
 public override void LoadCache()
 {
     _parent = Parent;
     _constructor = Constructor;
     _signature = Signature;
 }
Exemplo n.º 9
0
 public CustomAttribute(MetaDataMember parent, MethodReference constructor, uint value)
     : base(new MetaDataRow(0U,0U, value))
 {
     this._parent = parent;
     this._constructor = constructor;
 }
Exemplo n.º 10
0
 public override void LoadCache()
 {
     _parent      = Parent;
     _constructor = Constructor;
     _signature   = Signature;
 }
Exemplo n.º 11
0
 public override void ClearCache()
 {
     _parent      = null;
     _constructor = null;
     _signature   = null;
 }
Exemplo n.º 12
0
 public CustomAttribute(MetaDataMember parent, MethodReference constructor, uint value)
     : base(new MetaDataRow(0U, 0U, value))
 {
     this._parent      = parent;
     this._constructor = constructor;
 }
Exemplo n.º 13
0
 public MethodSpecification(MethodReference methodRef)
     : base(default(MetaDataRow))
 {
     OriginalMethod = methodRef;
     _context = methodRef;
 }