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