Ejemplo n.º 1
0
    def visit_BinaryOp(self, binop):
        binop = self.generic_visit(binop)

        if is_numeric(binop.lhs.type) and is_numeric(binop.rhs.type):
            binop.type = common_arithmetic_type(binop.lhs.type, binop.rhs.type)
        else:
            raise InvalidExpressionError(binop)

        return binop
Ejemplo n.º 2
0
 def type(self, args):
     return common_arithmetic_type(args[0].type, args[1].type)