コード例 #1
0
        public UnaryExpression(Location location, Operator unaryOperator, Expression operand)
            : base(location)
        {
            Operator = Utilities.ThrowIfNull(unaryOperator, "unaryOperator");
            Operand = Utilities.ThrowIfNull(operand, "operand");

            if(Operator.Token != '-')
                throw new ArgumentException(
                    Utilities.InvariantFormat("\"{0}\" is not unary operator.", Operator), "unaryOperator");
        }
コード例 #2
0
        public BinaryExpression(
            Location location, Operator binaryOperator, Expression leftExpression, Expression rightExpression)
            : base(location)
        {
            Operator = Utilities.ThrowIfNull(binaryOperator, "binaryOperator");
            LeftExpression = Utilities.ThrowIfNull(leftExpression, "leftExpression");
            RightExpression = Utilities.ThrowIfNull(rightExpression, "rightExpression");

            if(!Operator.IsBinaryOperator(Operator.Token))
                throw new ArgumentException(
                    Utilities.InvariantFormat("\"{0}\" is not binary operator.", Operator), "binaryOperator");
        }