public boolean validateBinaryExpr(BinaryExpr node) {
        ExprNode expr1 = node.getExpr1();
        ExprNode expr2 = node.getExpr2();
        Type t1 = expr1.getType();
        Type t2 = expr2.getType();
        String op = node.getOperation();
        switch (op) {
            case "==":
            case "!=":
                if (Types.isNumber(t1)) {
                    return this.requireNumber(expr2,t2);
                } else {
                    return true;
                    //TODO pass anything.may be Object needed?
                }
            case "+":
            case "-":
            case "*":
            case "/":
            case "%":
            case ">=":
            case "<=":
            case ">":
            case "<":
            case "&":
            case "|":
            case "^":
            case BinaryExpr.OP_SHIFT_LEFT:
            case BinaryExpr.OP_SHIFT_RIGHT:
            case BinaryExpr.OP_UNSIGNED_SHIFT_RIGHT:
                return this.requireNumber(expr1, t1) && this.requireNumber(expr2, t2);
            case "&&":
            case "||":
                return requireBoolean(expr1, t1) && requireBoolean(expr2, t2);
            default:
                diagnosisReporter.report(Diagnosis.Kind.ERROR, "unsupported operation:" + op, node.offset);
                return false;
        }
    }
public boolean validateBinaryExpr(BinaryExpr node) {
        ExprNode expr1 = node.getExpr1();
        ExprNode expr2 = node.getExpr2();
        Type t1 = expr1.getType();
        Type t2 = expr2.getType();
        String op = node.getOperation();
        switch (op) {
            case "==":
            case "!=":
                if (Types.isNumber(t1)) {
                    return this.requireNumber(expr2,t2);
                } else {
                    return true;
                   
                }
            case "+":
            case "-":
            case "*":
            case "/":
            case "%":
            case ">=":
            case "<=":
            case ">":
            case "<":
            case "&":
            case "|":
            case "^":
            case BinaryExpr.OP_SHIFT_LEFT:
            case BinaryExpr.OP_SHIFT_RIGHT:
            case BinaryExpr.OP_UNSIGNED_SHIFT_RIGHT:
                return this.requireNumber(expr1, t1) && this.requireNumber(expr2, t2);
            case "&&":
            case "||":
                return requireBoolean(expr1, t1) && requireBoolean(expr2, t2);
            default:
                diagnosisReporter.report(Diagnosis.Kind.ERROR, "unsupported operation:" + op, node.offset);
                return false;
        }
    }
public boolean validatebinaryexpr(binaryexpr node) { exprnode expr1 = node.getexpr1(); exprnode expr2 = node.getexpr2(); type t1 = expr1.gettype(); type t2 = expr2.gettype(); string op = node.getoperation(); switch (op) { case "==": case "!=": if (types.isnumber(t1)) { return this.requirenumber(expr2,t2); } else { return true; } case "+": case "-": case "*": case "/": case "%": case ">=": case "<=": case ">": case "<": case "&": case "|": case "^": case binaryexpr.op_shift_left: case binaryexpr.op_shift_right: case binaryexpr.op_unsigned_shift_right: return this.requirenumber(expr1, t1) && this.requirenumber(expr2, t2); case "&&": case "||": return requireboolean(expr1, t1) && requireboolean(expr2, t2); default: diagnosisreporter.report(diagnosis.kind.error, "unsupported operation:" + op, node.offset); return false; } }