Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions rd-net/RdFramework.Reflection/BindableChildrenUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Reflection;
using JetBrains.Diagnostics;
using JetBrains.Rd.Base;
using JetBrains.Rd.Tasks;
using JetBrains.Rd.Util;
using JetBrains.Util;

Expand Down Expand Up @@ -85,6 +86,13 @@ internal static void FillBindableFields(IReflectionBindable instance)
// value can be null for fields primitive types in RdModels. They are used in serializations, but send their value on bind
if (value != null)
obj.BindableChildren.Add(new KeyValuePair<string, object>(bindableMembers[i].Name, value));

if (value is IRdReactive reactive)
{
reactive.ValueCanBeNull = true;
if (value is IRdCall)
reactive.Async = true;
}
}
};
lock (ourFillBindableChildren)
Expand Down
11 changes: 0 additions & 11 deletions rd-net/RdFramework.Reflection/ReflectionRdActivator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -334,20 +334,9 @@ public static void SetHandler<TReq, TRes>(RdCall<TReq, TRes> endpoint, Func<Life
result = null;
}

SetAsync(result);

return result;
}

private static void SetAsync(object? result)
{
if (result is IRdReactive activatedBindable)
{
//foreach (var _ in mi.GetCustomAttributes(typeof(RdAsyncAttribute), false))
activatedBindable.Async = true;
}
}

private SerializerPair GetProperSerializer(Type type)
{
// registration for all statically known types
Expand Down
1 change: 1 addition & 0 deletions rd-net/RdFramework/Base/IRdReactive.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ namespace JetBrains.Rd.Base
public interface IRdReactive : IRdBindable, IRdWireable
{
bool Async { get; set; }
bool ValueCanBeNull { get; set; }
}


Expand Down
6 changes: 6 additions & 0 deletions rd-net/RdFramework/Impl/InternRoot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,12 @@ public bool Async
set => throw new NotSupportedException("Intern Roots are always async");
}

public bool ValueCanBeNull
{
get => false;
set => throw new NotSupportedException("Intern Roots are always non-nullable");
}

public void OnWireReceived(UnsafeReader reader, IRdWireableDispatchHelper dispatchHelper)
{
if (!TryGetSerializationContext(out var serializationCtx))
Expand Down
6 changes: 5 additions & 1 deletion rd-net/RdFramework/Tasks/Interfaces.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ public interface IRdEndpoint<TReq, TRes>
void SetRdTask(Func<Lifetime, TReq, RdTask<TRes>> handler, IScheduler? cancellationScheduler = null, IScheduler? handlerScheduler = null);
}

public interface IRdCall<in TReq, TRes>
public interface IRdCall
{
}

public interface IRdCall<in TReq, TRes> : IRdCall
{
TRes Sync(TReq request, RpcTimeouts? timeouts = null);

Expand Down
2 changes: 1 addition & 1 deletion rd-net/RdFramework/Tasks/RdCall.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace JetBrains.Rd.Tasks
{
public class RdCall<TReq, TRes> : RdReactiveBase, IRdCall<TReq, TRes>, IRdEndpoint<TReq, TRes>
public class RdCall<TReq, TRes> : RdReactiveBase, IRdCall<TReq, TRes>, IRdEndpoint<TReq, TRes>, IRdCall
{
[PublicAPI]
public CtxReadDelegate<TReq> ReadRequestDelegate { get; }
Expand Down
Loading