public override void VisitOrderByClause(OrderByClauseSyntax node) { IncrementNodeCount(2); // Direct equivalent of SQL's `ORDER BY` clause AddOperator("orderby"); base.VisitOrderByClause(node); }
private void ReduceOrderBy(OrderByClauseSyntax orderby, QueryTranslationState state, DiagnosticBag diagnostics) { // A query expression with an orderby clause // from x in e // orderby k1 , k2 , ... , kn // ... // is translated into // from x in ( e ) . // OrderBy ( x => k1 ) . // ThenBy ( x => k2 ) . // ... . // ThenBy ( x => kn ) // ... // If an ordering clause specifies a descending direction indicator, // an invocation of OrderByDescending or ThenByDescending is produced instead. bool first = true; foreach (var ordering in orderby.Orderings) { string methodName = (first ? "OrderBy" : "ThenBy") + (ordering.IsKind(SyntaxKind.DescendingOrdering) ? "Descending" : ""); var lambda = MakeQueryUnboundLambda(state.RangeVariableMap(), state.rangeVariable, ordering.Expression); var invocation = MakeQueryInvocation(ordering, state.fromExpression, methodName, lambda, diagnostics); state.fromExpression = MakeQueryClause(ordering, invocation, queryInvocation: invocation); first = false; } state.fromExpression = MakeQueryClause(orderby, state.fromExpression); }
public void VisitOrderByClause(OrderByClauseSyntax node) { if (node == null) { throw new ArgumentNullException("node"); } node.Validate(); if (!_writer.Configuration.LineBreaksAndWrapping.Other.PlaceLinqExpressionOnSingleLine) { _writer.Break(true); } _writer.WriteKeyword(PrinterKeyword.OrderBy); _writer.WriteSpace(); bool hadOne = false; foreach (var ordering in node.Orderings) { if (hadOne) { _writer.WriteListSeparator(); } else { hadOne = true; } ordering.Accept(this); } }
public override SyntaxNode VisitOrderByClause(OrderByClauseSyntax node) { if (!_visitQuerySyntax) { return(base.VisitOrderByClause(node)); } InvocationExpressionSyntax orderByInvocation; if (node.Orderings.Count == 1) { orderByInvocation = HandleOrderByExpression(node.Orderings.Single(), true); } else { orderByInvocation = HandleOrderByExpression(node.Orderings[0], true); foreach (OrderingSyntax orderingSyntax in node.Orderings.Skip(1)) { var invocation = HandleOrderByExpression(orderingSyntax, false); orderByInvocation = InvocationExpression( MemberAccessExpression( SyntaxKind.SimpleMemberAccessExpression, orderByInvocation, (IdentifierNameSyntax)invocation.Expression), invocation.ArgumentList); } } return(orderByInvocation); }
public override Evaluation VisitOrderByClause(OrderByClauseSyntax node) { foreach (OrderingSyntax ordering in node.Orderings) { ordering.Accept <Evaluation>(this); } return(base.VisitOrderByClause(node)); }
public override void VisitOrderByClause(OrderByClauseSyntax node) { foreach (OrderingSyntax ordering in node.Orderings) { ordering.Accept(this); } base.VisitOrderByClause(node); }
public override SyntaxNode VisitOrderByClause(OrderByClauseSyntax node) { var parent = node.Ancestors().FirstOrDefault(x => x.IsKind(SyntaxKind.InvocationExpression) || x.IsKind(SyntaxKind.QueryExpression)); if (parent != _root) { return(base.VisitOrderByClause(node)); } ThrowOrderByException(node.ToString()); return(node); }
public override void VisitOrderByClause(OrderByClauseSyntax node) { var paramInfo = m_LinqParamInfoStack.Peek(); var paramNames = paramInfo.ParamNames; string prestr = paramInfo.Prestr; paramInfo.Prestr = ", "; paramInfo.OrderByPrestr = string.Empty; CodeBuilder.AppendFormat("{0}{{\"orderby\", {{", prestr); base.VisitOrderByClause(node); CodeBuilder.Append("}}"); }
public override void VisitOrderByClause(OrderByClauseSyntax node) { if (!PreVisit(node)) { return; } foreach (OrderingSyntax ordering in node.Orderings) { ordering.Accept(this); } base.VisitOrderByClause(node); PostVisit(node); }
public static Doc Print(OrderByClauseSyntax node) { return(Doc.Concat( Token.Print(node.OrderByKeyword, " "), SeparatedSyntaxList.Print( node.Orderings, orderingNode => Doc.Concat( Node.Print(orderingNode.Expression), " ", Token.Print(orderingNode.AscendingOrDescendingKeyword) ), Doc.Null ) )); }
private Doc PrintOrderByClauseSyntax(OrderByClauseSyntax node) { return(Concat( this.PrintSyntaxToken(node.OrderByKeyword, " "), this.PrintSeparatedSyntaxList( node.Orderings, orderingNode => Concat( this.Print(orderingNode.Expression), this.PrintSyntaxToken( orderingNode.AscendingOrDescendingKeyword, null, " " ) ), Doc.Null ) )); }
private LuaExpressionSyntax BuildQueryOrderBy(LuaExpressionSyntax collection, OrderByClauseSyntax node, IQueryRangeVariable rangeVariable) { foreach (var ordering in node.Orderings) { bool isDescending = ordering.AscendingOrDescendingKeyword.IsKind(SyntaxKind.DescendingKeyword); if (ordering == node.Orderings.First()) { var methodName = isDescending ? LuaIdentifierNameSyntax.LinqOrderByDescending : LuaIdentifierNameSyntax.LinqOrderBy; collection = BuildOrdering(methodName, collection, ordering, rangeVariable); } else { var methodName = isDescending ? LuaIdentifierNameSyntax.LinqThenByDescending : LuaIdentifierNameSyntax.LinqThenBy; collection = BuildOrdering(methodName, collection, ordering, rangeVariable); } } return(collection); }
public override void VisitOrderByClause(OrderByClauseSyntax node) { throw new NotImplementedException(); }
/// <summary> /// /// </summary> /// <param name="node"></param> public override sealed void VisitOrderByClause(OrderByClauseSyntax node) { this.OnNodeVisited(node); if (!this.traverseRootOnly) base.VisitOrderByClause(node); }
public override void VisitOrderByClause(OrderByClauseSyntax node) { return; }
public override void VisitOrderByClause(OrderByClauseSyntax queryOrderClause) { base.VisitOrderByClause(queryOrderClause); _indexData.HasOrder = true; }
public override void VisitOrderByClause(OrderByClauseSyntax node) { Log(node, "Unsupported Syntax !"); }
/// <summary> /// /// </summary> /// <param name="node"></param> public override sealed void VisitOrderByClause(OrderByClauseSyntax node) { this.OnNodeVisited(node, this.type.IsInstanceOfType(node)); base.VisitOrderByClause(node); }
public override SyntaxNode VisitOrderByClause(OrderByClauseSyntax node) { node = (OrderByClauseSyntax)base.VisitOrderByClause(node); Classes.Add(node); return(node); }
public override void VisitOrderByClause(OrderByClauseSyntax node) { base.VisitOrderByClause(node); }
public void VisitOrderByClause(OrderByClauseSyntax node) { if (node == null) throw new ArgumentNullException("node"); node.Validate(); if (!_writer.Configuration.LineBreaksAndWrapping.Other.PlaceLinqExpressionOnSingleLine) _writer.Break(true); _writer.WriteKeyword(PrinterKeyword.OrderBy); _writer.WriteSpace(); bool hadOne = false; foreach (var ordering in node.Orderings) { if (hadOne) _writer.WriteListSeparator(); else hadOne = true; ordering.Accept(this); } }
private void ReduceOrderBy(OrderByClauseSyntax orderby, QueryTranslationState state, DiagnosticBag diagnostics) { // A query expression with an orderby clause // from x in e // orderby k1 , k2 , ... , kn // ... // is translated into // from x in ( e ) . // OrderBy ( x => k1 ) . // ThenBy ( x => k2 ) . // ... . // ThenBy ( x => kn ) // ... // If an ordering clause specifies a descending direction indicator, // an invocation of OrderByDescending or ThenByDescending is produced instead. bool first = true; foreach (var ordering in orderby.Orderings) { string methodName = (first ? "OrderBy" : "ThenBy") + (ordering.IsKind(SyntaxKind.DescendingOrdering) ? "Descending" : ""); var lambda = MakeQueryUnboundLambda(state.RangeVariableMap(), state.rangeVariable, ordering.Expression); var invocation = MakeQueryInvocation(ordering, state.fromExpression, methodName, lambda, diagnostics); state.fromExpression = MakeQueryClause(ordering, invocation, queryInvocation: invocation); first = false; } state.fromExpression = MakeQueryClause(orderby, state.fromExpression); }
/// <inheritdoc /> public override Expression VisitOrderByClause(OrderByClauseSyntax node) { throw Unexpected(node, nameof(VisitQueryExpression)); }
// // Summary: // Called when the visitor visits a OrderByClauseSyntax node. public virtual void VisitOrderByClause(OrderByClauseSyntax node);
public TameOrderByClauseSyntax(OrderByClauseSyntax node) { Node = node; AddChildren(); }