Exemplo n.º 1
0
        /// <summary>
        /// Negates an expression.
        /// If possible, replaces the operator of exp if exp is a negatable OperatorExpression,
        /// else return a new OperatorExpression of type Not that wraps exp.
        /// </summary>
        public static VisitedExpression Negate(VisitedExpression exp, bool useNewPrecedences)
        {
            OperatorExpression expOp = exp as OperatorExpression;

            if (expOp != null)
            {
                Operator op    = expOp.op;
                Operator newOp = null;
                if (Operator.NegateDict.TryGetValue(op, out newOp))
                {
                    expOp.op = newOp;
                    return(expOp);
                }
                if (expOp.op == Operator.Not)
                {
                    return(expOp.right);
                }
            }

            return(OperatorExpression.Build(Operator.Not, useNewPrecedences, exp));
        }
Exemplo n.º 2
0
 internal void And(VisitedExpression andAlso)
 {
     // useNewPrecedence doesn't matter here since there was no change with the AND operator
     _where = OperatorExpression.Build(Operator.And, true, _where, andAlso);
 }
Exemplo n.º 3
0
 internal void And(VisitedExpression andAlso)
 {
     _where = OperatorExpression.Build(Operator.And, _where, andAlso);
 }