(self, o: BreakStmt)
| 510 | self.tracker.skip_branch() |
| 511 | |
| 512 | def visit_break_stmt(self, o: BreakStmt) -> None: |
| 513 | super().visit_break_stmt(o) |
| 514 | if self.loops: |
| 515 | self.loops[-1].has_break = True |
| 516 | # Track variables that are definitely defined at the point of break |
| 517 | if len(self.tracker._scope().branch_stmts) > 0: |
| 518 | branch = self.tracker._scope().branch_stmts[-1].branches[-1] |
| 519 | if self.loops[-1].break_vars is None: |
| 520 | self.loops[-1].break_vars = set(branch.must_be_defined) |
| 521 | else: |
| 522 | # we only want variables that have been defined in each branch |
| 523 | self.loops[-1].break_vars.intersection_update(branch.must_be_defined) |
| 524 | self.tracker.skip_branch() |
| 525 | |
| 526 | def visit_expression_stmt(self, o: ExpressionStmt) -> None: |
| 527 | typ = self.type_map.get(o.expr) |
nothing calls this directly
no test coverage detected