Exemple #1
0
        public BinaryExpression(Expression left, Binop op, Expression right)
        {
            if (left == null)
            {
                throw new ArgumentNullException(nameof(left));
            }
            if (right == null)
            {
                throw new ArgumentNullException(nameof(right));
            }

            Left  = left;
            Op    = op;
            Right = right;
        }
Exemple #2
0
 public BinaryExpression(Expression left, Binop op, Expression right)
 {
 }
 public AssignExpression(Expression left, Binop op, Expression right)
 {
 }
Exemple #4
0
    // ************************************************
    // * EXPRESSIONS
    // ************************************************

    public Type visit(Binop n) {

        // based on op type, perform corresponding checks

        Type t1 = n.e1.accept(this);
        Type t2 = n.e2.accept(this);

        if (compatible(t1,  t2)) {

            if ((n.op == Binop.ADD) || (n.op == Binop.SUB) ||(n.op == Binop.MUL) ||(n.op == Binop.DIV)) {
                if (compatible(t1,  intType)) {
                    return t1;
                }
            }

            else if ((n.op == Binop.AND) || (n.op == Binop.OR)) {
                if (compatible(t1,  boolType)) {
                    return t1;
                }
            }
            else {
                throw new TypeException("Indeterminate Binop encountered.");
            }
        }

        throw new TypeException("Binop operands' type mismatch: "+ t1.toString()+ n.opName(n.op) + t2.toString());
    }
Exemple #5
0
 public AssignExpression(Expression left, Binop op, Expression right)
 {
 }
Exemple #6
0
 public BinaryExpression(Expression left, Binop op, Expression right)
 {
 }