Пример #1
0
        public MethodDefinition resolve(MethodReference method)
        {
            if (method == null)
            {
                return(null);
            }
            var methodDef = method as MethodDefinition;

            if (methodDef != null)
            {
                return(methodDef);
            }

            var type = resolve(method.DeclaringType);

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

            foreach (var m in type.Methods)
            {
                if (MemberReferenceHelper.compareMethodReference(method, m))
                {
                    return(m);
                }
            }

            return(null);
        }
Пример #2
0
        public MMethod getMethod(MethodReference methodReference)
        {
            var type = getType(methodReference.DeclaringType);

            if (type != null)
            {
                return(type.getMethod(methodReference));
            }
            if (!MemberReferenceHelper.compareTypes(moduleType, methodReference.DeclaringType))
            {
                return(null);
            }

            initGlobalMethods();
            foreach (var method in tokenToGlobalMethod.Values)
            {
                if (MemberReferenceHelper.compareMethodReference(methodReference, method.methodDefinition))
                {
                    return(method);
                }
            }

            return(null);
        }