private BoundExpression Negate(BoundExpression condition)
            {
                if (condition is BoundLiteralExpression l)
                {
                    var value = (bool)l.Value;
                    return(new BoundLiteralExpression(!value));
                }
                var op = BoundUnaryOperator.Bind(SyntaxKind.BangToken, TypeSymbol.Bool);

                return(new BoundUnaryExpression(op, condition));
            }
Beispiel #2
0
 public BoundUnaryExpression(BoundUnaryOperator op, BoundExpression operand)
 {
     Op      = op;
     Operand = operand;
 }