Example #1
0
 public HostEnvironment()
 {
     var xAsmRef = new ReflectionAssemblyReference(this, typeof(object).Assembly);
     this.SystemInt32 = xAsmRef.ResolveTypeReference(typeof(Int32).FullName);
     this.SystemObject = xAsmRef.ResolveTypeReference(typeof(object).FullName);
     this.SystemVoid = xAsmRef.ResolveTypeReference(typeof(void).FullName);
 }
Example #2
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;
 }