(self)
| 750 | self.target_type = target_type |
| 751 | |
| 752 | def gen_condition(self) -> None: |
| 753 | builder = self.builder |
| 754 | line = self.line |
| 755 | self.return_value = Register(object_rprimitive) |
| 756 | err = builder.add(LoadErrorValue(object_rprimitive, undefines=True)) |
| 757 | builder.assign(self.return_value, err, line) |
| 758 | |
| 759 | # Call generated generator helper method, passing a PyObject ** as the final |
| 760 | # argument that will be used to store the return value in the return value |
| 761 | # register. We ignore the return value but the presence of a return value |
| 762 | # indicates that the generator has finished. This is faster than raising |
| 763 | # and catching StopIteration, which is the non-native way of doing this. |
| 764 | ptr = builder.add(LoadAddress(object_pointer_rprimitive, self.return_value)) |
| 765 | nn = builder.none_object() |
| 766 | helper_call = MethodCall( |
| 767 | builder.read(self.iter_target, line), |
| 768 | GENERATOR_HELPER_NAME, |
| 769 | [nn, nn, nn, nn, ptr], |
| 770 | line, |
| 771 | ) |
| 772 | # We provide custom handling for error values. |
| 773 | helper_call.error_kind = ERR_NEVER |
| 774 | |
| 775 | self.next_reg = builder.add(helper_call) |
| 776 | builder.add(Branch(self.next_reg, self.loop_exit, self.body_block, Branch.IS_ERROR)) |
| 777 | |
| 778 | def begin_body(self) -> None: |
| 779 | # Assign the value obtained from the generator helper method to the |
nothing calls this directly
no test coverage detected