protected override Expression VisitUnary(UnaryExpression node)
        {
            if (node.NodeType != ExpressionType.Not)
            {
                throw new Exception();
            }
            var operand = node.Operand;
            ExpressionVisitorBase base2 = null;

            if (operand.NodeType == ExpressionType.Call)
            {
                base2 = new MethodCallExpressionVisitor(Context);
            }
            else
            {
                if (operand.NodeType != ExpressionType.MemberAccess)
                {
                    throw new Exception();
                }
                base2 = new MemberExpressionVisitor(Context);
            }
            base2.Visit(node);
            Token = base2.Token;
            if (Token.IsBool())
            {
                Token = Token.Create(!(bool)Token.Object);
                return(node);
            }
            if (Token.Type != TokenType.Column)
            {
                throw new Exception();
            }
            var condition1 = new Condition
            {
                CompareType = CompareType.Not,
                Left        = Token
            };

            Token = Token.Create(condition1);
            return(node);
        }
예제 #2
0
        public override Expression Visit(Expression node)
        {
            ExpressionVisitorBase base2 = null;

            if (node.NodeType == ExpressionType.Quote)
            {
                node = ((UnaryExpression)node).Operand;
            }
            if (node.NodeType == ExpressionType.Lambda)
            {
                node = ((LambdaExpression)node).Body;
            }
            if (node.NodeType == ExpressionType.Call)
            {
                base2 = new MethodCallExpressionVisitor(Context);
            }
            else
            {
                base2 = new PropertyFieldExpressionVisitor(Context);
            }
            base2.Visit(node);
            Token = base2.Token;
            return(node);
        }