Skip to content

Commit

Permalink
add NRT annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
nenoNaninu committed Nov 27, 2023
1 parent 5680adc commit a29c7fc
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/TypedSignalR.Client/Templates/MethodMetadataExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public static string CreateArgumentsString(this MethodMetadata methodMetadata)

var sb = new StringBuilder();

sb.Append("new object[] { ");
sb.Append("new object?[] { ");
sb.Append(methodMetadata.Parameters[0].Name);

for (int i = 1; i < methodMetadata.Parameters.Count; i++)
Expand All @@ -63,7 +63,8 @@ public static string CreateArgumentsString(this MethodMetadata methodMetadata)
public static string CreateArgumentsStringExceptCancellationToken(this MethodMetadata methodMetadata, SpecialSymbols specialSymbols)
{
var parameters = methodMetadata.Parameters
.Where(x => !SymbolEqualityComparer.Default.Equals(x.Type, specialSymbols.CancellationTokenSymbol)).ToArray();
.Where(x => !SymbolEqualityComparer.Default.Equals(x.Type, specialSymbols.CancellationTokenSymbol))
.ToArray();

if (parameters.Length == 0)
{
Expand All @@ -72,7 +73,7 @@ public static string CreateArgumentsStringExceptCancellationToken(this MethodMet

var sb = new StringBuilder();

sb.Append("new object[] { ");
sb.Append("new object?[] { ");
sb.Append(parameters[0].Name);

for (int i = 1; i < parameters.Length; i++)
Expand Down Expand Up @@ -183,8 +184,8 @@ public static string CreateMethodString(this MethodMetadata methodMetadata, Spec
HubMethodType.ServerStreamingAsAsyncEnumerable => CreateServerStreamingMethodAsAsyncEnumerableString(methodMetadata, specialSymbols),
HubMethodType.ServerStreamingAsTaskAsyncEnumerable => CreateServerStreamingMethodAsTaskAsyncEnumerableString(methodMetadata, specialSymbols),
HubMethodType.ServerStreamingAsChannel => CreateServerStreamingMethodAsChannelString(methodMetadata, specialSymbols),
HubMethodType.ClientStreamingAsAsyncEnumerable => CreateClientStreamingMethodAsAsyncEnumerableString(methodMetadata, specialSymbols),
HubMethodType.ClientStreamingAsChannel => CreateClientStreamingMethodAsChannelString(methodMetadata, specialSymbols),
HubMethodType.ClientStreamingAsAsyncEnumerable => CreateClientStreamingMethodAsAsyncEnumerableString(methodMetadata),
HubMethodType.ClientStreamingAsChannel => CreateClientStreamingMethodAsChannelString(methodMetadata),
_ => string.Empty
};
}
Expand Down Expand Up @@ -294,7 +295,7 @@ private static string CreateServerStreamingMethodAsChannelString(MethodMetadata
""";
}

private static string CreateClientStreamingMethodAsAsyncEnumerableString(MethodMetadata method, SpecialSymbols specialSymbols)
private static string CreateClientStreamingMethodAsAsyncEnumerableString(MethodMetadata method)
{
return $$"""
public {{method.ReturnType}} {{method.MethodName}}({{method.CreateParametersString()}})
Expand All @@ -304,7 +305,7 @@ private static string CreateClientStreamingMethodAsAsyncEnumerableString(MethodM
""";
}

private static string CreateClientStreamingMethodAsChannelString(MethodMetadata method, SpecialSymbols specialSymbols)
private static string CreateClientStreamingMethodAsChannelString(MethodMetadata method)
{
return $$"""
Expand Down

0 comments on commit a29c7fc

Please sign in to comment.