@@ -1702,60 +1702,7 @@ void PushScopes(
1702
1702
1703
1703
if ( query . sort is { by . Length : > 0 } )
1704
1704
{
1705
- if ( sources . Length == 1 )
1706
- @return = SortClause ( query , @return ) ;
1707
- else
1708
- {
1709
- throw new NotImplementedException ( "Sort is broken in ELM XSD?" ) . WithContext ( this ) ;
1710
- //foreach (var by in query.sort.by)
1711
- //{
1712
- // var order = ListSortDirection.Ascending;
1713
- // if (by.direction == "desc" || by.direction == "descending")
1714
- // order = ListSortDirection.Descending;
1715
- // else if (by.direction == "asc" || by.direction == "ascending")
1716
- // order = ListSortDirection.Ascending;
1717
- // else throw ctx.NewExpressionBuildingException($"Invalid sort order {by.direction}");
1718
-
1719
- // if (by.expression != null)
1720
- // {
1721
- // var parameterName = "@this";
1722
- // var returnElementType = TypeResolver.GetListElementType(@return.Type);
1723
- // var sortMemberParameter = Expression.Parameter(returnElementType, parameterName);
1724
- // var subContext = ctx.WithImpliedAlias(parameterName!, sortMemberParameter, by.expression);
1725
- // var sortMemberExpression = TranslateExpression(by.expression, subContext);
1726
- // var lambdaBody = Expression.Convert(sortMemberExpression, typeof(object));
1727
- // var sortLambda = System.Linq.Expressions.Expression.Lambda(lambdaBody, sortMemberParameter);
1728
- // var sort = Operators.Bind(CqlOperator.SortBy, ctx.RuntimeContextParameter,
1729
- // @return, sortLambda, Expression.Constant(order, typeof(SortOrder)));
1730
- // @return = sort;
1731
- // }
1732
- // else if (by.path != null && by.resultTypeName != null)
1733
- // {
1734
- // var parameterName = "@this";
1735
- // var returnElementType = TypeResolver.GetListElementType(@return.Type);
1736
- // var sortMemberParameter = Expression.Parameter(returnElementType, parameterName);
1737
- // var pathMemberType = TypeResolver.ResolveType(by.resultTypeName);
1738
- // if (pathMemberType == null)
1739
- // {
1740
- // var msg = $"Type specifier {by.resultTypeName} at {by.locator ?? "unknown"} could not be resolved.";
1741
- // ctx.LogError(msg);
1742
- // throw ctx.NewExpressionBuildingException(msg);
1743
- // }
1744
- // var pathExpression = PropertyHelper(sortMemberParameter, by.path, pathMemberType!, ctx);
1745
- // var lambdaBody = Expression.Convert(pathExpression, typeof(object));
1746
- // var sortLambda = System.Linq.Expressions.Expression.Lambda(lambdaBody, sortMemberParameter);
1747
- // var sort = Operators.Bind(CqlOperator.SortBy, ctx.RuntimeContextParameter,
1748
- // @return, sortLambda, Expression.Constant(order, typeof(SortOrder)));
1749
- // @return = sort;
1750
- // }
1751
- // else
1752
- // {
1753
- // var sort = Operators.Bind(CqlOperator.Sort, ctx.RuntimeContextParameter,
1754
- // @return, Expression.Constant(order, typeof(SortOrder)));
1755
- // @return = sort;
1756
- // }
1757
- //}
1758
- }
1705
+ @return = SortClause ( query , @return ) ;
1759
1706
}
1760
1707
1761
1708
// Because we promoted the source to a list, we now have to demote the result again.
0 commit comments