System.Dynamic.Utils.ExpressionVisitorUtils.VisitBlockExpressions C# (CSharp) Method

VisitBlockExpressions() public static method

public static VisitBlockExpressions ( ExpressionVisitor visitor, System.Linq.Expressions.BlockExpression block ) : System.Linq.Expressions.Expression[]
visitor System.Linq.Expressions.ExpressionVisitor
block System.Linq.Expressions.BlockExpression
return System.Linq.Expressions.Expression[]
        public static Expression[] VisitBlockExpressions(ExpressionVisitor visitor, BlockExpression block)
        {
            Expression[] newNodes = null;
            for (int i = 0, n = block.ExpressionCount; i < n; i++)
            {
                Expression curNode = block.GetExpression(i);
                Expression node = visitor.Visit(curNode);

                if (newNodes != null)
                {
                    newNodes[i] = node;
                }
                else if (!object.ReferenceEquals(node, curNode))
                {
                    newNodes = new Expression[n];
                    for (int j = 0; j < i; j++)
                    {
                        newNodes[j] = block.GetExpression(j);
                    }
                    newNodes[i] = node;
                }
            }
            return newNodes;
        }