Skip to content

Commit a3a3e68

Browse files
committed
Removed custom concat implementation
Signed-off-by: Manuel Menegazzo <[email protected]>
1 parent e002cee commit a3a3e68

File tree

4 files changed

+5
-32
lines changed

4 files changed

+5
-32
lines changed

src/Dapr.Actors.Generators/ActorClientGenerator.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,13 +153,13 @@ static void GenerateActorClientCode(SourceProductionContext context, ActorClient
153153
.Select(member => GenerateMethodImplementation(member, actorMethodAttributeSymbol, cancellationTokenSymbol));
154154

155155
var actorMembers = new List<MemberDeclarationSyntax>()
156-
.Concat(actorProxyFieldDeclaration)
157-
.Concat(actorCtor)
156+
.Append(actorProxyFieldDeclaration)
157+
.Append(actorCtor)
158158
.Concat(actorMethods);
159159

160160
var actorClientClassModifiers = new List<SyntaxKind>()
161161
.Concat(SyntaxFactoryHelpers.GetSyntaxKinds(descriptor.Accessibility))
162-
.Concat(SyntaxKind.SealedKeyword)
162+
.Append(SyntaxKind.SealedKeyword)
163163
.Select(sk => SyntaxFactory.Token(sk));
164164

165165
var actorClientClassDeclaration = SyntaxFactory.ClassDeclaration(descriptor.ClientTypeName)

src/Dapr.Actors.Generators/Extensions/IEnumerableExtensions.cs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,5 @@ internal static int IndexOf<T>(this IEnumerable<T> source, Func<T, bool> predica
3030

3131
return -1;
3232
}
33-
34-
/// <summary>
35-
/// Concatenates the specified item to the end of the sequence.
36-
/// </summary>
37-
/// <typeparam name="T"></typeparam>
38-
/// <param name="source"></param>
39-
/// <param name="item"></param>
40-
/// <returns></returns>
41-
internal static IEnumerable<T> Concat<T>(this IEnumerable<T> source, T item)
42-
{
43-
return source.Concat(new[] { item });
44-
}
4533
}
4634
}

src/Dapr.Actors.Generators/Helpers/SyntaxFactoryHelpers.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
using Dapr.Actors.Generators.Extensions;
2-
using Microsoft.CodeAnalysis;
1+
using Microsoft.CodeAnalysis;
32
using Microsoft.CodeAnalysis.CSharp;
43
using Microsoft.CodeAnalysis.CSharp.Syntax;
54

@@ -99,7 +98,7 @@ public static InvocationExpressionSyntax ActorProxyInvokeMethodAsync(
9998
// Define the arguments to pass to the actor proxy method invocation.
10099
var proxyInvocationArguments = new List<ArgumentSyntax>()
101100
// Name of remote method to invoke.
102-
.Concat(SyntaxFactory.Argument(SyntaxFactory.LiteralExpression(SyntaxKind.StringLiteralExpression, SyntaxFactory.Literal(remoteMethodName))))
101+
.Append(SyntaxFactory.Argument(SyntaxFactory.LiteralExpression(SyntaxKind.StringLiteralExpression, SyntaxFactory.Literal(remoteMethodName))))
103102
// Actor method arguments, including the CancellationToken if it exists.
104103
.Concat(remoteMethodParameters.Select(p => SyntaxFactory.Argument(SyntaxFactory.IdentifierName(p.Name))));
105104

test/Dapr.Actors.Generators.Test/Extensions/IEnumerableExtensionsTests.cs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,5 @@ public void IndexOf_WhenItemExists_ReturnsIndexOfItem(int[] source, int item, in
4848
// Assert
4949
Assert.Equal(expected, index);
5050
}
51-
52-
[Fact]
53-
public void Concat_WhenItemIsNotNull_ReturnsConcatenatedSequence()
54-
{
55-
// Arrange
56-
var source = new[] { "a", "b", "c" };
57-
string item = "d";
58-
59-
// Act
60-
var result = source.Concat(item);
61-
62-
// Assert
63-
Assert.Equal(new[] { "a", "b", "c", "d" }, result);
64-
}
6551
}
6652
}

0 commit comments

Comments
 (0)