void EmitCtorForSafeNullProxy(ILGenerator gen, Type returnType)
        {
            // The argument for the constructor is already on the stack (which is the return value
            // from the method call on the real subject).
            var pcd       = SafeFactory.CreateSafeNullProxyDescriptorFor(returnType);
            var proxyType = _proxyModule.GetTypeFromProxyClassDescriptor(pcd);

            StaticInstanceMixin.PushInstanceOnStackFor(proxyType, gen);
        }
Пример #2
0
 public virtual void PushDefaultReturnValue(ILGenerator gen, Type returnType)
 {
     if (returnType.IsInterface())
     {
         var pcd       = SafeFactory.CreateSafeNullProxyDescriptorFor(returnType);
         var proxyType = _proxyModule.GetTypeFromProxyClassDescriptor(pcd);
         StaticInstanceMixin.PushInstanceOnStackFor(proxyType, gen);
     }
     else
     {
         gen.EmitLdDefaultValue(returnType);
     }
 }