protected override Expression VisitUnary(UnaryExpression expression) { SPModelQueryExpressionScope currentScope = stack.Peek(); SPModelQueryExpressionScope childScope = new SPModelQueryExpressionScope(this); stack.Push(childScope); Visit(expression.Operand); switch (expression.NodeType) { case ExpressionType.Not: currentScope.Expression = ~childScope.Expression; break; case ExpressionType.Convert: case ExpressionType.ConvertChecked: case ExpressionType.Quote: childScope.CopyTo(currentScope); break; default: throw new NotSupportedException(String.Format("The unary operator '{0}' is not supported", expression.NodeType)); } stack.Pop(); return(expression); }
protected override Expression VisitUnary(UnaryExpression expression) { if (invariantExpression || builder.SelectExpression != null) { return(base.VisitUnary(expression)); } SPModelQueryExpressionScope currentScope = this.currentScope; SPModelQueryExpressionScope childScope = new SPModelQueryExpressionScope(this); this.currentScope = childScope; Visit(expression.Operand); switch (expression.NodeType) { case ExpressionType.Not: currentScope.Expression = ~childScope.Expression; break; case ExpressionType.Convert: case ExpressionType.ConvertChecked: case ExpressionType.Quote: childScope.CopyTo(currentScope); break; default: throw new NotSupportedException(String.Format("Unary operator '{0}' is not supported", expression.NodeType)); } this.currentScope = currentScope; return(expression); }