Exemplo n.º 1
0
        internal LiteralExpressionPart StartNewLiteral()
        {
            LiteralExpressionPart literal = new LiteralExpressionPart();

            subParts.Add(literal);
            return(literal);
        }
        protected override Expression VisitLambda <T>(Expression <T> node)
        {
            if (expectLambdaVisit)
            {
                expectLambdaVisit = false;
            }
            else
            {
                LambdaExpressionPart newLambda = new LambdaExpressionPart(CurrentLambda);
                CurrentLambda.Body.StartLambda(newLambda);
                CurrentLiteral = newLambda.Parameters;
                CurrentLambda  = newLambda;
            }

            if (node.Parameters.Count == 1)
            {
                Visit(node.Parameters[0]);
            }
            else
            {
                VisitExpressions('(', node.Parameters, ')');
            }

            CurrentLiteral = CurrentLambda.Body.StartNewLiteral();

            Visit(node.Body);

            if (CurrentLambda.Parent != null)
            {
                CurrentLambda  = CurrentLambda.Parent;
                CurrentLiteral = CurrentLambda.Body.StartNewLiteral();
            }

            return(node);
        }