Rewrite() private method

Makes a copy of this node replacing the args with the provided values. The number of the args needs to match the number of the current block. This helper is provided to allow re-writing of nodes to not depend on the specific optimized subclass of DynamicExpression which is being used.
private Rewrite ( Expression args ) : DynamicExpression
args Expression
return DynamicExpression
 protected internal virtual Expression VisitDynamic(DynamicExpression node)
 {
     Expression[] args = this.VisitArguments(node);
     if (args == null)
     {
         return(node);
     }
     return(node.Rewrite(args));
 }
Example #2
0
        /// <summary>
        /// Visits the children of the <see cref="DynamicExpression" />.
        /// </summary>
        /// <param name="node">The expression to visit.</param>
        /// <returns>The modified expression, if it or any subexpression was modified;
        /// otherwise, returns the original expression.</returns>
        protected internal override Expression VisitDynamic(DynamicExpression node)
        {
            Expression[]? a = ExpressionVisitorUtils.VisitArguments(this, node);
            if (a == null)
            {
                return(node);
            }

            return(node.Rewrite(a));
        }
Example #3
0
        /// <summary>
        /// Visits the children of the <see cref="DynamicExpression" />.
        /// </summary>
        /// <param name="node">The expression to visit.</param>
        /// <returns>The modified expression, if it or any subexpression was modified;
        /// otherwise, returns the original expression.</returns>
        protected internal virtual Expression VisitDynamic(DynamicExpression node)
        {
            Expression[] a = VisitArguments((IArgumentProvider)node);
            if (a == null)
            {
                return(node);
            }

            return(node.Rewrite(a));
        }
        /// <summary>
        /// Visits the children of the <see cref="DynamicExpression" />.
        /// </summary>
        /// <param name="node">The expression to visit.</param>
        /// <returns>The modified expression, if it or any subexpression was modified;
        /// otherwise, returns the original expression.</returns>
        protected internal virtual Expression VisitDynamic(DynamicExpression node)
        {
            Expression[] a = ExpressionVisitorUtils.VisitArguments(this, node);
            if (a == null)
            {
                return node;
            }

            return node.Rewrite(a);
        }
        /// <summary>
        ///     Visits the children of the <see cref="DynamicExpression" />.
        /// </summary>
        /// <param name="node">The expression to visit.</param>
        /// <returns>
        ///     The modified expression, if it or any subexpression was modified;
        ///     otherwise, returns the original expression.
        /// </returns>
        protected internal override Expression VisitDynamic(DynamicExpression node)
        {
            if (node == null)
            {
                throw new ArgumentNullException(nameof(node));
            }

            var a = ExpressionVisitorUtils.VisitArguments(this, node);

            return(a == null ? node : node.Rewrite(a));
        }
Example #6
0
        /// <summary>
        ///     Visits the children of the <see cref="DynamicExpression" />.
        /// </summary>
        /// <param name="node">The expression to visit.</param>
        /// <returns>
        ///     The modified expression, if it or any subexpression was modified;
        ///     otherwise, returns the original expression.
        /// </returns>
        protected internal virtual Expression VisitDynamic(DynamicExpression node)
        {
            if (node == null)
            {
                throw new ArgumentNullException(nameof(node));
            }

            var a = VisitArguments(node);

            return(a == null ? node : node.Rewrite(a));
        }
Example #7
0
        /// <summary>
        /// Visits the children of the <see cref="DynamicExpression" />.
        /// </summary>
        /// <param name="node">The expression to visit.</param>
        /// <returns>The modified expression, if it or any subexpression was modified;
        /// otherwise, returns the original expression.</returns>
        protected internal virtual Expression VisitDynamic(DynamicExpression node)
        {
            var a = VisitArguments(node);

            if (a == null)
            {
                return(node);
            }

            return(node.Rewrite(a));
        }
        /// <inheritdoc />
        /// <summary>
        ///     Visits the children of the <see cref="T:System.Linq.Expressions.DynamicExpression" />.
        /// </summary>
        /// <param name="node">The expression to visit.</param>
        /// <returns>
        ///     The modified expression, if it or any subexpression was modified;
        ///     otherwise, returns the original expression.
        /// </returns>
        protected internal override Expression VisitDynamic(DynamicExpression node)
        {
            var a = ExpressionVisitorUtils.VisitArguments(this, node);

            return(a == null ? node : node.Rewrite(a));
        }