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
def type(self, args): return common_arithmetic_type(args[0].type, args[1].type)