protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { QueryFromClause o = other as QueryFromClause; return(o != null && this.Type.DoMatch(o.Type, match) && MatchString(this.Identifier, o.Identifier) && this.Expression.DoMatch(o.Expression, match)); }
S IAstVisitor <T, S> .VisitQueryFromClause(QueryFromClause queryFromClause, T data) { var handler = QueryFromClauseVisited; if (handler != null) { handler(queryFromClause, data); } return(VisitChildren(queryFromClause, data)); }
public override AstNode VisitQueryFromClause(QueryFromClause queryFromClause) { if (currentResult == null) { AddFirstMemberToCurrentTransparentType(queryFromClause.IdentifierToken); if (queryFromClause.Type.IsNull) { return(VisitNested(queryFromClause.Expression, null)); } else { return(VisitNested(queryFromClause.Expression, null).Invoke("Cast", new[] { queryFromClause.Type.Clone() }, new Expression[0])); } } else { var innerSelectorParam = CreateParameterForCurrentRangeVariable(); var innerSelector = CreateLambda(new[] { innerSelectorParam }, VisitNested(queryFromClause.Expression, innerSelectorParam)); var clonedIdentifier = (Identifier)queryFromClause.IdentifierToken.Clone(); var resultParam = CreateParameterForCurrentRangeVariable(); Expression body; // Second from clause - SelectMany var select = GetNextQueryClause(queryFromClause) as QuerySelectClause; if (select != null) { body = VisitNested(select.Expression, resultParam); eatSelect = true; } else { body = AddMemberToCurrentTransparentType(resultParam, queryFromClause.IdentifierToken, new IdentifierExpression(queryFromClause.Identifier), false); } var resultSelectorParam2 = CreateParameter(clonedIdentifier); var resultSelector = CreateLambda(new[] { resultParam, resultSelectorParam2 }, body); rangeVariables[queryFromClause.IdentifierToken] = resultSelectorParam2; return(currentResult.Invoke("SelectMany", innerSelector, resultSelector)); } }
void IAstVisitor.VisitQueryFromClause(QueryFromClause queryFromClause) { Visit(EnterQueryFromClause, LeaveQueryFromClause, queryFromClause); }