Beispiel #1
0
 public CSBinaryExpression(CSBinaryOperator op, ICSExpression lhs, ICSExpression rhs)
 {
     Operation = op;
     Left      = Exceptions.ThrowOnNull(lhs, "lhs");
     Right     = Exceptions.ThrowOnNull(rhs, "rhs");
 }
Beispiel #2
0
        static string OpToString(CSBinaryOperator op)
        {
            switch (op)
            {
            case CSBinaryOperator.Add:
                return("+");

            case CSBinaryOperator.Sub:
                return("-");

            case CSBinaryOperator.Mul:
                return("*");

            case CSBinaryOperator.Div:
                return("/");

            case CSBinaryOperator.Mod:
                return("%");

            case CSBinaryOperator.And:
                return("&&");

            case CSBinaryOperator.Or:
                return("||");

            case CSBinaryOperator.Less:
                return("<");

            case CSBinaryOperator.Greater:
                return(">");

            case CSBinaryOperator.Equal:
                return("==");

            case CSBinaryOperator.NotEqual:
                return("!=");

            case CSBinaryOperator.LessEqual:
                return("<=");

            case CSBinaryOperator.GreaterEqual:
                return(">=");

            case CSBinaryOperator.BitAnd:
                return("&");

            case CSBinaryOperator.BitOr:
                return("|");

            case CSBinaryOperator.BitXor:
                return("^");

            case CSBinaryOperator.LeftShift:
                return(">>");

            case CSBinaryOperator.RightShift:
                return("<<");

            case CSBinaryOperator.Dot:
                return(".");

            case CSBinaryOperator.Is:
                return("is");

            case CSBinaryOperator.As:
                return("as");

            case CSBinaryOperator.NullCoalesce:
                return("??");

            default:
                throw new ArgumentOutOfRangeException("op");
            }
        }