コード例 #1
0
        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 override void GenerateConversion(IProxyModuleCoderAccess proxyModule, ILGenerator gen)
        {
            var proxyType = proxyModule.GetTypeFromProxyClassDescriptor(_pcd);
            var ctor      = proxyType.GetConstructor(new[] { _fromType });

            gen.Emit(OpCodes.Newobj, ctor);
        }
コード例 #3
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);
     }
 }
コード例 #4
0
 public override void GenerateConversion(IProxyModuleCoderAccess proxyModule, ILGenerator gen)
 {
     var proxyType = proxyModule.GetTypeFromProxyClassDescriptor(_pcd);
     var ctor = proxyType.GetConstructor(new[] {_fromType});
     gen.Emit(OpCodes.Newobj, ctor);
 }