Пример #1
0
 public override MethodReference ResolveMethod(string name)
 {
     var xResult = mType.GetMethod(name, System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static, null, new Type[0], null);
     if (xResult != null)
     {
         object xMethodRef;
         if (Assembly.Host.ImportsObjectMap.TryGetValue(xResult, out xMethodRef))
         {
             return (MethodReference)xMethodRef;
         }
         object xReturnTypeRef;
         if(!Assembly.Host.ImportsObjectMap.TryGetValue(xResult.ReturnType, out xReturnTypeRef))
         {
             object xAsmRef;
             if(!Assembly.Host.ImportsObjectMap.TryGetValue(xResult.ReturnType.Assembly, out xAsmRef))
             {
                 xAsmRef = new ReflectionAssemblyReference(Assembly.Host, xResult.ReturnType.Assembly);
                 Assembly.Host.ImportsObjectMap.Add(xResult.ReturnType.Assembly, xAsmRef);
             }
             xReturnTypeRef = new ReflectionTypeReference(xResult.ReturnType, (AssemblyReference)xAsmRef);
             Assembly.Host.ImportsObjectMap.Add(xResult.ReturnType, xReturnTypeRef);
         }
         xMethodRef = new ReflectionMethodReference(xResult, this, (ReflectionTypeReference)xReturnTypeRef);
         Assembly.Host.ImportsObjectMap.Add(xResult, xMethodRef);
         return (MethodReference)xMethodRef;
     }
     return null;
 }
Пример #2
0
 public ReflectionMethodReference(MethodBase method, ReflectionTypeReference typeRef, ReflectionTypeReference returnType)
 {
     mDeclaringType = typeRef;
     mMethod = method;
     mReturnType = returnType;
 }