예제 #1
0
 def visit_NativeFuncCall(self,
                          node: NativeFuncCall) -> gtir.NativeFuncCall:
     return gtir.NativeFuncCall(
         func=self.GT4PY_NATIVE_FUNC_TO_GTIR[node.func],
         args=[self.visit(arg) for arg in node.args],
         loc=location_to_source_location(node.loc),
     )
예제 #2
0
 def visit_BinOpExpr(self, node: BinOpExpr) -> Union[gtir.BinaryOp, gtir.NativeFuncCall]:
     if node.op in (BinaryOperator.POW, BinaryOperator.MOD):
         return gtir.NativeFuncCall(
             func=common.NativeFunction[node.op.name],
             args=[self.visit(node.lhs), self.visit(node.rhs)],
         )
     return gtir.BinaryOp(
         left=self.visit(node.lhs),
         right=self.visit(node.rhs),
         op=self.GT4PY_OP_TO_GTIR_OP[node.op],
     )
예제 #3
0
 def visit_NativeFuncCall(self, node: NativeFuncCall) -> gtir.NativeFuncCall:
     return gtir.NativeFuncCall(
         func=self.GT4PY_NATIVE_FUNC_TO_GTIR[node.func],
         args=[self.visit(arg) for arg in node.args],
     )