(
self, op: str, dest: Value, left: Value, right: Value, expected: str
)
| 1021 | assert visitor.op_index == 0 |
| 1022 | |
| 1023 | def assert_emit_binary_op( |
| 1024 | self, op: str, dest: Value, left: Value, right: Value, expected: str |
| 1025 | ) -> None: |
| 1026 | if op in binary_ops: |
| 1027 | ops = binary_ops[op] |
| 1028 | for desc in ops: |
| 1029 | if is_subtype(left.type, desc.arg_types[0]) and is_subtype( |
| 1030 | right.type, desc.arg_types[1] |
| 1031 | ): |
| 1032 | args = [left, right] |
| 1033 | if desc.ordering is not None: |
| 1034 | args = [args[i] for i in desc.ordering] |
| 1035 | # This only supports primitives that map to C calls |
| 1036 | assert desc.c_function_name is not None |
| 1037 | self.assert_emit( |
| 1038 | CallC( |
| 1039 | desc.c_function_name, |
| 1040 | args, |
| 1041 | desc.return_type, |
| 1042 | desc.steals, |
| 1043 | desc.is_borrowed, |
| 1044 | desc.error_kind, |
| 1045 | 55, |
| 1046 | ), |
| 1047 | expected, |
| 1048 | ) |
| 1049 | return |
| 1050 | else: |
| 1051 | assert False, "Could not find matching op" |
| 1052 | |
| 1053 | |
| 1054 | class TestGenerateFunction(unittest.TestCase): |
no test coverage detected