예제 #1
0
 def visit_BinOp(self, node):
     left = self.visit(node.left)
     right = self.visit(node.right)
     # special case pow for positive integral exponent
     if ispowi(node):
         right = 'std::integral_constant<long, {}>{{}}'.format(
             node.right.value)
     if isstr(node.left):
         left = "pythonic::types::str({})".format(left)
     elif isstr(node.right):
         right = "pythonic::types::str({})".format(right)
     return operator_to_lambda[type(node.op)](left, right)
예제 #2
0
    def visit_BinOp(self, node):
        if ispowi(node):
            self.visit(node.op)
            self.visit(node.left)
            cty = "std::integral_constant<long, %s>" % (node.right.value)
            self.result[node.right] = self.builder.NamedType(cty)
        else:
            self.generic_visit(node)

        def F(x, y):
            return self.builder.ExpressionType(
                operator_to_lambda[type(node.op)], (x, y))

        self.combine(node, node.left, F)
        self.combine(node, node.right, F)