public virtual void VisitQueryGroupClause(QueryGroupClause queryGroupClause) { if (ThrowException) { throw (Exception)CreateException(queryGroupClause); } }
public virtual void VisitQueryGroupClause(QueryGroupClause queryGroupClause) { if (this.ThrowException) { throw (System.Exception) this.CreateException(queryGroupClause); } }
public RedILNode VisitQueryGroupClause(QueryGroupClause queryGroupClause, State data) { throw new System.NotImplementedException(); }
public virtual void VisitQueryGroupClause(QueryGroupClause queryGroupClause) { VisitChildren (queryGroupClause); }
public virtual void VisitQueryGroupClause(QueryGroupClause queryGroupClause) { if (this.ThrowException) { throw (Exception)this.CreateException(queryGroupClause); } }
public override void VisitQueryGroupClause(QueryGroupClause syntax) { _underlyingVisitor.VisitQueryGroupClause(syntax); }
public override void VisitQueryGroupClause(QueryGroupClause queryGroupClause) { }
/// <inheritdoc/> public virtual void VisitQueryGroupClause(QueryGroupClause syntax) { VisitNode(syntax); }
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { QueryGroupClause o = other as QueryGroupClause; return(o != null && this.Projection.DoMatch(o.Projection, match) && this.Key.DoMatch(o.Key, match)); }
public UnifiedElement VisitQueryGroupClause( QueryGroupClause queryGroupClause, object data) { throw new NotImplementedException("QueryGroupClause"); }
public Node VisitQueryGroupClause(QueryGroupClause queryGroupClause) { return(CreateDummy(queryGroupClause)); }
public void VisitQueryGroupClause(QueryGroupClause queryGroupClause) { throw new NotImplementedException(); }
public virtual S VisitQueryGroupClause(QueryGroupClause queryGroupClause, T data) { return(VisitChildren(queryGroupClause, data)); }
public void VisitQueryGroupClause(QueryGroupClause node) { NotSupported(node); }
public StringBuilder VisitQueryGroupClause(QueryGroupClause queryGroupClause, int data) { throw new ASLException("ASL does not understand LINQ."); }
public override object Visit (Mono.CSharp.Linq.GroupBy groupBy) { var result = new QueryGroupClause (); var location = LocationsBag.GetLocations (groupBy); if (location != null) result.AddChild (new CSharpTokenNode (Convert (location[0]), "group".Length), QueryGroupClause.GroupKeywordRole); // result.AddChild ((AstNode)groupBy.ElementSelector.Accept (this), QueryGroupClause.GroupByExpressionRole); // if (location != null) // result.AddChild (new CSharpTokenNode (Convert (location[1]), "by".Length), QueryGroupClause.ByKeywordRole); // result.AddChild ((AstNode)groupBy.Expr.Accept (this), QueryGroupClause.ProjectionExpressionRole); return result; }
public override void VisitQueryGroupClause(QueryGroupClause queryGroupClause) { throw NotSupportedToConsistency(); }
public StringBuilder VisitQueryGroupClause(QueryGroupClause queryGroupClause) { return(InvalidNode(queryGroupClause, "LINQ is not supported")); }
public StringBuilder VisitQueryGroupClause(QueryGroupClause queryGroupClause, int data) { throw new SLSharpException("SL# does not understand LINQ."); }
public override void VisitQueryGroupClause(QueryGroupClause queryGroupClause) { FixClauseIndentation(queryGroupClause, queryGroupClause.GroupKeyword); }
public override void VisitQueryGroupClause(QueryGroupClause queryGroupClause) { base.VisitQueryGroupClause(queryGroupClause); indexData.HasGroup = true; }
public void VisitQueryGroupClause(QueryGroupClause queryGroupClause) { throw new NotImplementedException(); }
QueryExpression DecompileQuery(InvocationExpression invocation) { if (invocation == null) { return(null); } MemberReferenceExpression mre = invocation.Target as MemberReferenceExpression; if (mre == null || IsNullConditional(mre.Target)) { return(null); } switch (mre.MemberName) { case "Select": { if (invocation.Arguments.Count != 1) { return(null); } if (!IsComplexQuery(mre)) { return(null); } Expression expr = invocation.Arguments.Single(); if (MatchSimpleLambda(expr, out ParameterDeclaration parameter, out Expression body)) { QueryExpression query = new QueryExpression(); query.Clauses.Add(MakeFromClause(parameter, mre.Target.Detach())); query.Clauses.Add(new QuerySelectClause { Expression = WrapExpressionInParenthesesIfNecessary(body.Detach(), parameter.Name) }.CopyAnnotationsFrom(expr)); return(query); } return(null); } case "GroupBy": { if (invocation.Arguments.Count == 2) { Expression keyLambda = invocation.Arguments.ElementAt(0); Expression projectionLambda = invocation.Arguments.ElementAt(1); if (MatchSimpleLambda(keyLambda, out ParameterDeclaration parameter1, out Expression keySelector) && MatchSimpleLambda(projectionLambda, out ParameterDeclaration parameter2, out Expression elementSelector) && parameter1.Name == parameter2.Name) { QueryExpression query = new QueryExpression(); query.Clauses.Add(MakeFromClause(parameter1, mre.Target.Detach())); var queryGroupClause = new QueryGroupClause { Projection = elementSelector.Detach(), Key = keySelector.Detach() }; queryGroupClause.AddAnnotation(new QueryGroupClauseAnnotation(keyLambda.Annotation <IL.ILFunction>(), projectionLambda.Annotation <IL.ILFunction>())); query.Clauses.Add(queryGroupClause); return(query); } } else if (invocation.Arguments.Count == 1) { Expression lambda = invocation.Arguments.Single(); if (MatchSimpleLambda(lambda, out ParameterDeclaration parameter, out Expression keySelector)) { QueryExpression query = new QueryExpression(); query.Clauses.Add(MakeFromClause(parameter, mre.Target.Detach())); query.Clauses.Add(new QueryGroupClause { Projection = new IdentifierExpression(parameter.Name).CopyAnnotationsFrom(parameter), Key = keySelector.Detach() }); return(query); } } return(null); } case "SelectMany": { if (invocation.Arguments.Count != 2) { return(null); } var fromExpressionLambda = invocation.Arguments.ElementAt(0); if (!MatchSimpleLambda(fromExpressionLambda, out ParameterDeclaration parameter, out Expression collectionSelector)) { return(null); } if (IsNullConditional(collectionSelector)) { return(null); } LambdaExpression lambda = invocation.Arguments.ElementAt(1) as LambdaExpression; if (lambda != null && lambda.Parameters.Count == 2 && lambda.Body is Expression) { ParameterDeclaration p1 = lambda.Parameters.ElementAt(0); ParameterDeclaration p2 = lambda.Parameters.ElementAt(1); if (p1.Name == parameter.Name) { QueryExpression query = new QueryExpression(); query.Clauses.Add(MakeFromClause(p1, mre.Target.Detach())); query.Clauses.Add(MakeFromClause(p2, collectionSelector.Detach()).CopyAnnotationsFrom(fromExpressionLambda)); query.Clauses.Add(new QuerySelectClause { Expression = WrapExpressionInParenthesesIfNecessary(((Expression)lambda.Body).Detach(), parameter.Name) }); return(query); } } return(null); } case "Where": { if (invocation.Arguments.Count != 1) { return(null); } if (!IsComplexQuery(mre)) { return(null); } Expression expr = invocation.Arguments.Single(); if (MatchSimpleLambda(expr, out ParameterDeclaration parameter, out Expression body)) { QueryExpression query = new QueryExpression(); query.Clauses.Add(MakeFromClause(parameter, mre.Target.Detach())); query.Clauses.Add(new QueryWhereClause { Condition = body.Detach() }.CopyAnnotationsFrom(expr)); return(query); } return(null); } case "OrderBy": case "OrderByDescending": case "ThenBy": case "ThenByDescending": { if (invocation.Arguments.Count != 1) { return(null); } if (!IsComplexQuery(mre)) { return(null); } var lambda = invocation.Arguments.Single(); if (MatchSimpleLambda(lambda, out ParameterDeclaration parameter, out Expression orderExpression)) { if (ValidateThenByChain(invocation, parameter.Name)) { QueryOrderClause orderClause = new QueryOrderClause(); while (mre.MemberName == "ThenBy" || mre.MemberName == "ThenByDescending") { // insert new ordering at beginning orderClause.Orderings.InsertAfter( null, new QueryOrdering { Expression = orderExpression.Detach(), Direction = (mre.MemberName == "ThenBy" ? QueryOrderingDirection.None : QueryOrderingDirection.Descending) }.CopyAnnotationsFrom(lambda)); InvocationExpression tmp = (InvocationExpression)mre.Target; mre = (MemberReferenceExpression)tmp.Target; lambda = tmp.Arguments.Single(); MatchSimpleLambda(lambda, out parameter, out orderExpression); } // insert new ordering at beginning orderClause.Orderings.InsertAfter( null, new QueryOrdering { Expression = orderExpression.Detach(), Direction = (mre.MemberName == "OrderBy" ? QueryOrderingDirection.None : QueryOrderingDirection.Descending) }.CopyAnnotationsFrom(lambda)); QueryExpression query = new QueryExpression(); query.Clauses.Add(MakeFromClause(parameter, mre.Target.Detach())); query.Clauses.Add(orderClause); return(query); } } return(null); } case "Join": case "GroupJoin": { if (invocation.Arguments.Count != 4) { return(null); } Expression source1 = mre.Target; Expression source2 = invocation.Arguments.ElementAt(0); if (IsNullConditional(source2)) { return(null); } Expression outerLambda = invocation.Arguments.ElementAt(1); if (!MatchSimpleLambda(outerLambda, out ParameterDeclaration element1, out Expression key1)) { return(null); } Expression innerLambda = invocation.Arguments.ElementAt(2); if (!MatchSimpleLambda(innerLambda, out ParameterDeclaration element2, out Expression key2)) { return(null); } LambdaExpression lambda = invocation.Arguments.ElementAt(3) as LambdaExpression; if (lambda != null && lambda.Parameters.Count == 2 && lambda.Body is Expression) { ParameterDeclaration p1 = lambda.Parameters.ElementAt(0); ParameterDeclaration p2 = lambda.Parameters.ElementAt(1); if (p1.Name == element1.Name && (p2.Name == element2.Name || mre.MemberName == "GroupJoin")) { QueryExpression query = new QueryExpression(); query.Clauses.Add(MakeFromClause(element1, source1.Detach())); QueryJoinClause joinClause = new QueryJoinClause(); joinClause.JoinIdentifier = element2.Name; // join elementName2 joinClause.JoinIdentifierToken.CopyAnnotationsFrom(element2); joinClause.InExpression = source2.Detach(); // in source2 joinClause.OnExpression = key1.Detach(); // on key1 joinClause.EqualsExpression = key2.Detach(); // equals key2 if (mre.MemberName == "GroupJoin") { joinClause.IntoIdentifier = p2.Name; // into p2.Name joinClause.IntoIdentifierToken.CopyAnnotationsFrom(p2); } joinClause.AddAnnotation(new QueryJoinClauseAnnotation(outerLambda.Annotation <IL.ILFunction>(), innerLambda.Annotation <IL.ILFunction>())); query.Clauses.Add(joinClause); query.Clauses.Add(new QuerySelectClause { Expression = ((Expression)lambda.Body).Detach() }.CopyAnnotationsFrom(lambda)); return(query); } } return(null); } default: return(null); } }
public override void VisitQueryGroupClause(QueryGroupClause queryGroupClause) { base.VisitQueryGroupClause(queryGroupClause); indexData.HasGroup = true; }
public override object Visit(Mono.CSharp.Linq.GroupBy groupBy) { var result = new QueryGroupClause(); var location = LocationsBag.GetLocations(groupBy); result.AddChild(new CSharpTokenNode(Convert(groupBy.Location), QueryGroupClause.GroupKeywordRole), QueryGroupClause.GroupKeywordRole); if (groupBy.ElementSelector != null) result.AddChild((Expression)groupBy.ElementSelector.Accept(this), QueryGroupClause.ProjectionRole); if (location != null) { var byLoc = Convert(location[0]); if (byLoc.Line > 1 || byLoc.Column > 1) result.AddChild(new CSharpTokenNode(byLoc, QueryGroupClause.ByKeywordRole), QueryGroupClause.ByKeywordRole); } if (groupBy.Expr != null) result.AddChild((Expression)groupBy.Expr.Accept(this), QueryGroupClause.KeyRole); return result; }
public JNode VisitQueryGroupClause(QueryGroupClause node) { throw new NotImplementedException(); }
public void VisitQueryGroupClause(QueryGroupClause queryGroupClause) { StartNode(queryGroupClause); WriteKeyword(QueryGroupClause.GroupKeywordRole); Space(); queryGroupClause.Projection.AcceptVisitor(this); Space(); WriteKeyword(QueryGroupClause.ByKeywordRole); Space(); queryGroupClause.Key.AcceptVisitor(this); EndNode(queryGroupClause); }
public virtual Node VisitQueryGroupClause(QueryGroupClause queryGroupClause) { throw new System.NotImplementedException(); }