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