示例#1
0
        static string OperatorToString(CSUnaryOperator op)
        {
            switch (op)
            {
            case CSUnaryOperator.At:
                return("@");

            case CSUnaryOperator.BitNot:
                return("~");

            case CSUnaryOperator.Neg:
                return("-");

            case CSUnaryOperator.Not:
                return("!");

            case CSUnaryOperator.Out:
                return("out");

            case CSUnaryOperator.Pos:
                return("+");

            case CSUnaryOperator.Ref:
                return("ref");

            case CSUnaryOperator.AddressOf:
                return("&");

            case CSUnaryOperator.Indirection:
                return("*");

            default:
                throw new ArgumentOutOfRangeException(nameof(op));
            }
        }
示例#2
0
 public CSUnaryExpression(CSUnaryOperator op, ICSExpression expr)
 {
     Operation = op;
     Expr      = Exceptions.ThrowOnNull(expr, nameof(expr));
 }