Beispiel #1
0
        /// <summary>
        /// Creates a textual representation of the LambdaAbstraction with the given children.
        /// </summary>
        /// <param name="node">Original query expression.</param>
        /// <param name="arguments">Argument query expressions.</param>
        /// <returns>Representation of the original query expression.</returns>
        protected override string MakeLambdaAbstraction(LambdaAbstraction node, ReadOnlyCollection <string> arguments)
        {
            if (node.Parameters.Count == 0)
            {
                return(string.Format(CultureInfo.InvariantCulture, "@LambdaAbstraction({0})", node.Body.ToString()));
            }

            return(string.Format(CultureInfo.InvariantCulture, "@LambdaAbstraction({0}, {1})", node.Body.ToString(), string.Join(", ", arguments)));
        }
Beispiel #2
0
        /// <summary>
        /// Visits a <see cref="LambdaAbstraction" /> node.
        /// </summary>
        /// <param name="node">Node to visit.</param>
        /// <returns>Result of visiting the node.</returns>
        protected internal override QueryTree VisitLambdaAbstraction(LambdaAbstraction node)
        {
            var body = VisitLambdaAbstractionBody(node.Body);
            var args = Visit(node.Parameters);

            if (body != node.Body || args != node.Parameters)
            {
                return(MakeLambdaAbstraction(node, body, args));
            }

            return(node);
        }
Beispiel #3
0
        /// <summary>
        /// Visits a <see cref="LambdaAbstraction" /> node.
        /// </summary>
        /// <param name="node">Node to visit.</param>
        /// <returns>Result of visiting the node.</returns>
        protected internal override QueryTree VisitLambdaAbstraction(LambdaAbstraction node)
        {
            // This is overridden so we can use the nongeneric Visit function on ReadOnlyCollection which
            // will perform an element-wise equality check to see if the collection has changed
            var args = Visit(node.Parameters);

            if (args != node.Parameters)
            {
                return(MakeLambdaAbstraction(node, args));
            }

            return(node);
        }
Beispiel #4
0
 /// <summary>
 /// Makes a <see cref="LambdaAbstraction" /> with the given children.
 /// </summary>
 /// <param name="node">Original query expression.</param>
 /// <param name="arguments">Argument query expressions.</param>
 /// <returns>Representation of the original query expression.</returns>
 protected sealed override QueryTree MakeLambdaAbstraction(LambdaAbstraction node, ReadOnlyCollection <QueryTree> arguments)
 {
     return(DefaultQueryExpressionFactory.Instance.LambdaAbstraction(node.Body, arguments));
 }
Beispiel #5
0
 /// <summary>
 /// Makes a <see cref="LambdaAbstraction" /> with the given children.
 /// </summary>
 /// <param name="node">Original query expression.</param>
 /// <param name="body">Body expression.</param>
 /// <param name="arguments">Argument query expressions.</param>
 /// <returns>Representation of the original query expression.</returns>
 protected virtual QueryTree MakeLambdaAbstraction(LambdaAbstraction node, LambdaExpression body, ReadOnlyCollection <QueryTree> arguments)
 {
     return(DefaultQueryExpressionFactory.Instance.LambdaAbstraction(body, arguments));
 }