示例#1
0
        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));
        }
示例#2
0
        S IAstVisitor <T, S> .VisitQueryFromClause(QueryFromClause queryFromClause, T data)
        {
            var handler = QueryFromClauseVisited;

            if (handler != null)
            {
                handler(queryFromClause, data);
            }
            return(VisitChildren(queryFromClause, data));
        }
示例#3
0
            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));
                }
            }
示例#4
0
 void IAstVisitor.VisitQueryFromClause(QueryFromClause queryFromClause)
 {
     Visit(EnterQueryFromClause, LeaveQueryFromClause, queryFromClause);
 }