Пример #1
0
        private BoundExpression BindNullIfExpression(NullIfExpressionSyntax node)
        {
            // NULLIF(left, right)
            //
            // ===>
            //
            // CASE WHEN left != right THEN left END

            var expressions     = BindToCommonType(new[] { node.LeftExpression, node.RightExpression });
            var boundLeft       = expressions[0];
            var boundRight      = expressions[1];
            var boundComparison = BindBinaryExpression(node.Span, BinaryOperatorKind.NotEqual, boundLeft, boundRight);
            var boundCaseLabel  = new BoundCaseLabel(boundComparison, boundLeft);

            return(new BoundCaseExpression(new[] { boundCaseLabel }, null));
        }
Пример #2
0
 public virtual void VisitNullIfExpression(NullIfExpressionSyntax node)
 {
     DefaultVisit(node);
 }
Пример #3
0
 public virtual TResult VisitNullIfExpression(NullIfExpressionSyntax node)
 {
     return(DefaultVisit(node));
 }