Contains information about implicit generator function classes.
| 161 | |
| 162 | |
| 163 | class GeneratorClass(ImplicitClass): |
| 164 | """Contains information about implicit generator function classes.""" |
| 165 | |
| 166 | def __init__(self, ir: ClassIR) -> None: |
| 167 | super().__init__(ir) |
| 168 | # This register holds the label number that the '__next__' function should go to the next |
| 169 | # time it is called. |
| 170 | self._next_label_reg: Value | None = None |
| 171 | self._next_label_target: AssignmentTarget | None = None |
| 172 | |
| 173 | # These registers hold the error values for the generator object for the case that the |
| 174 | # 'throw' function is called. |
| 175 | self.exc_regs: tuple[Value, Value, Value] | None = None |
| 176 | |
| 177 | # Holds the arg passed to send |
| 178 | self.send_arg_reg: Value | None = None |
| 179 | |
| 180 | # Holds the PyObject ** pointer through which return value can be passed |
| 181 | # instead of raising StopIteration(ret_value) (only if not NULL). This |
| 182 | # is used for faster native-to-native calls. |
| 183 | self.stop_iter_value_reg: Value | None = None |
| 184 | |
| 185 | # The switch block is used to decide which instruction to go using the value held in the |
| 186 | # next-label register. |
| 187 | self.switch_block = BasicBlock() |
| 188 | self.continuation_blocks: list[BasicBlock] = [] |
| 189 | |
| 190 | @property |
| 191 | def next_label_reg(self) -> Value: |
| 192 | assert self._next_label_reg is not None |
| 193 | return self._next_label_reg |
| 194 | |
| 195 | @next_label_reg.setter |
| 196 | def next_label_reg(self, reg: Value) -> None: |
| 197 | self._next_label_reg = reg |
| 198 | |
| 199 | @property |
| 200 | def next_label_target(self) -> AssignmentTarget: |
| 201 | assert self._next_label_target is not None |
| 202 | return self._next_label_target |
| 203 | |
| 204 | @next_label_target.setter |
| 205 | def next_label_target(self, target: AssignmentTarget) -> None: |
| 206 | self._next_label_target = target |
no outgoing calls
no test coverage detected
searching dependent graphs…