Esempio n. 1
0
 def visit_BinOp(self, node):
     left = self.visit(node.left)
     right = self.visit(node.right)
     return self.factory_stack[-1].exec_expr(tasks.BinOpTask(node.op),
                                             [(left, "left"),
                                              (right, "right")],
                                             quick=True,
                                             syncpoint=False)
Esempio n. 2
0
 def visit_Compare(self, node):
     assert len(node.comparators) == 1
     left = self.visit(node.left)
     right = self.visit(node.comparators[0])
     op = node.ops[0]
     
     return self.factory_stack[-1].exec_expr(tasks.BinOpTask(op), 
                                             [(left, "left"), (right, "right")],
                                             quick=True, syncpoint=False)
Esempio n. 3
0
    def test_compare(self):
        def f(a, b):
            return a == b

        expected = G(C(START_TICK, "a", 1, "left"),
                     C(START_TICK, "b", 1, "right"),
                     T(1, tasks.BinOpTask(ast.Eq()), {'quick': True}),
                     C(1, "value", FINAL_TICK, "retval"))

        callee = translator.translate_function(f, "scheduler", False)
        utils.assert_graph_equal(expected, callee.graph)