diff --git a/src/Core/Queries/GremlinQuery.cs b/src/Core/Queries/GremlinQuery.cs index bb5224f06..7cd8d081d 100644 --- a/src/Core/Queries/GremlinQuery.cs +++ b/src/Core/Queries/GremlinQuery.cs @@ -507,7 +507,7 @@ private TTargetQuery Choose(Func, object>(this)).TargetQuery; } - private TReturnQuery Coalesce(params Func, TTargetQuery>[] continuations) + private TReturnQuery Coalesce(Func, TTargetQuery>[] continuations) where TTargetQuery : IGremlinQueryBase where TReturnQuery : IGremlinQueryBase => this .Continue() @@ -546,14 +546,14 @@ private GremlinQuery Coin(double probability) => this .AddStep(new CoinStep(probability)), probability); - private GremlinQuery Concat(params string[] strings) => this + private GremlinQuery Concat(string[] strings) => this .Continue() .Build( static (builder, strings) => builder .AddStep(new ConcatStringsStep(strings.ToImmutableArray())), strings); - private GremlinQuery Concat(params Func, IGremlinQueryBase>[] stringTraversals) => this + private GremlinQuery Concat(Func, IGremlinQueryBase>[] stringTraversals) => this .Continue() .With(stringTraversals) .Build(static (builder, stringTraversals) => builder @@ -1117,7 +1117,7 @@ private IMapGremlinQuery Project(Func Properties(Projection projection, params Expression[] projections) => Properties( + private GremlinQuery Properties(Projection projection, Expression[] projections) => Properties( projection, projections .Select(projection => GetKey(projection).RawKey) @@ -1210,23 +1210,14 @@ private TNewQuery Select(StepLabel stepLabel) where TNewQuery : IGrem .As(), (stepLabel, stepLabelProjection: GetLabelProjection(stepLabel))); - private TTargetQuery Select(params Expression[] projections) where TTargetQuery : IGremlinQueryBase => this + private TTargetQuery Select(Expression expression) where TTargetQuery : IGremlinQueryBase => this .Continue() .Build( - static (builder, projections) => + static (builder, expression) => { - var keys = projections - .Select(static expression => - { - if (expression is LambdaExpression { Parameters: [var singleParameter], Body: { } lambdaBody } && lambdaBody.IsIndexerGet(out var target, out var indexerArgument) && target == singleParameter) - { - if (indexerArgument.GetValue() is string indexerArgumentValue) - return indexerArgumentValue; - } - - return (Key)expression.AssumePropertyOrFieldMemberExpression().Member.Name; - }) - .ToImmutableArray(); + var keys = ImmutableArray.Create(expression is LambdaExpression { Parameters: [var singleParameter], Body: { } lambdaBody } && lambdaBody.IsIndexerGet(out var target, out var indexerArgument) && target == singleParameter && indexerArgument.GetValue() is string indexerArgumentValue + ? indexerArgumentValue + : (Key)expression.AssumePropertyOrFieldMemberExpression().Member.Name); return builder .AddStep(new SelectKeysStep(keys)) @@ -1235,7 +1226,7 @@ private TTargetQuery Select(params Expression[] projections) where keys) .As(); }, - projections); + expression); private GremlinQuery SideEffect(Func, IGremlinQueryBase> sideEffectContinuation) => this .Continue() @@ -1328,11 +1319,10 @@ private GremlinQuery Unfold() => this private TTargetQuery Unfold() => Unfold().CloneAs(); - private TTargetQuery Union(params Func, TTargetQuery>[] unionTraversals) - where TTargetQuery : IGremlinQueryBase => - Union(unionTraversals); + private TTargetQuery Union(Func, TTargetQuery>[] unionTraversals) + where TTargetQuery : IGremlinQueryBase => Union(unionTraversals); - private TReturnQuery Union(params Func, TTargetQuery>[] unionContinuations) + private TReturnQuery Union(Func, TTargetQuery>[] unionContinuations) where TTargetQuery : IGremlinQueryBase where TReturnQuery : IGremlinQueryBase => this .Continue()