/// <summary>
        /// Creates a new expression that is like this one, but using the supplied children. If all of the children are the same, it will return this expression.
        /// </summary>
        /// <param name="left">The <see cref="Left" /> property of the result.</param>
        /// <param name="right">The <see cref="Right" /> property of the result.</param>
        /// <returns>This expression if no children changed, or an expression with the updated children.</returns>
        public BinaryDynamicCSharpExpression Update(DynamicCSharpArgument left, DynamicCSharpArgument right)
        {
            if (left == Left && right == Right)
            {
                return(this);
            }

            return(DynamicCSharpExpression.MakeDynamicBinary(OperationNodeType, left, right, Flags, Context));
        }
        private Expression ReduceLogical(bool isAndAlso)
        {
            var leftVariable   = Expression.Parameter(Type, "__left");
            var resultVariable = Expression.Parameter(Type, "__result");
            var left           = Left.Update(leftVariable);

            Expression     check;
            ExpressionType underlyingOperation;

            if (isAndAlso)
            {
                check = DynamicCSharpExpression.DynamicIsFalse(left, CSharpBinderFlags.None, Context);
                underlyingOperation = ExpressionType.And;
            }
            else
            {
                check = DynamicCSharpExpression.DynamicIsTrue(left, CSharpBinderFlags.None, Context);
                underlyingOperation = ExpressionType.Or;
            }

            var flags = Flags & ~CSharpBinderFlags.BinaryOperationLogical;

            var operation = DynamicCSharpExpression.MakeDynamicBinary(underlyingOperation, left, Right, flags, Context);

            var body =
                Expression.IfThenElse(
                    check,
                    Expression.Assign(resultVariable, leftVariable),
                    Expression.Assign(resultVariable, operation)
                    );

            var res =
                Expression.Block(
                    Type,
                    new[] { leftVariable, resultVariable },
                    Expression.Assign(leftVariable, Left.Expression),
                    body,
                    resultVariable
                    );

            return(res);
        }