protected internal virtual Expression VisitBlock(BlockExpression node) { int expressionCount = node.ExpressionCount; Expression[] args = null; for (int i = 0; i < expressionCount; i++) { Expression expression = node.GetExpression(i); Expression expression2 = this.Visit(expression); if (expression != expression2) { if (args == null) { args = new Expression[expressionCount]; } args[i] = expression2; } } ReadOnlyCollection <ParameterExpression> variables = this.VisitAndConvert <ParameterExpression>(node.Variables, "VisitBlock"); if ((variables == node.Variables) && (args == null)) { return(node); } for (int j = 0; j < expressionCount; j++) { if (args[j] == null) { args[j] = node.GetExpression(j); } } return(node.Rewrite(variables, args)); }
/// <summary> /// Visits the children of the <see cref="BlockExpression"/>. /// </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 VisitBlock(BlockExpression node) { Expression[] nodes = ExpressionVisitorUtils.VisitBlockExpressions(this, node); ReadOnlyCollection <ParameterExpression> v = VisitAndConvert(node.Variables, "VisitBlock"); if (v == node.Variables && nodes == null) { return(node); } return(node.Rewrite(v, nodes)); }
private Expression VisitBlockExtracted(BlockExpression node) { var nodes = ExpressionVisitorUtils.VisitBlockExpressions(this, node); var v = VisitAndConvert(node.Variables, nameof(VisitBlock)); if (v == node.Variables && nodes == null) { return(node); } return(node.Rewrite(v, nodes)); }
/// <summary> /// Visits the children of the <see cref="BlockExpression"/>. /// </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 VisitBlock(BlockExpression node) { var nodes = ExpressionVisitorUtils.VisitBlockExpressions(this, node); var v = VisitAndConvert(node.Variables, "VisitBlock"); if (v == node.Variables && nodes == null) { return(node); } return(node.Rewrite(v, nodes)); }
/// <summary> /// Visits the children of the <see cref="BlockExpression" />. /// </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 VisitBlock(BlockExpression node) { int count = node.ExpressionCount; Expression[] nodes = null; for (int i = 0; i < count; i++) { Expression oldNode = node.GetExpression(i); Expression newNode = Visit(oldNode); if (oldNode != newNode) { if (nodes == null) { nodes = new Expression[count]; } nodes[i] = newNode; } } var v = VisitAndConvert(node.Variables, "VisitBlock"); if (v == node.Variables && nodes == null) { return(node); } if (nodes != null) { for (int i = 0; i < count; i++) { if (nodes[i] == null) { nodes[i] = node.GetExpression(i); } } } return(node.Rewrite(v, nodes)); }