(self, s: ForStmt)
| 5492 | self.visit_block_maybe(s.else_body) |
| 5493 | |
| 5494 | def visit_for_stmt(self, s: ForStmt) -> None: |
| 5495 | if s.is_async: |
| 5496 | if not self.is_func_scope() or not self.function_stack[-1].is_coroutine: |
| 5497 | self.fail(message_registry.ASYNC_FOR_OUTSIDE_COROUTINE, s, code=codes.SYNTAX) |
| 5498 | |
| 5499 | self.statement = s |
| 5500 | s.expr.accept(self) |
| 5501 | |
| 5502 | # Bind index variables and check if they define new names. |
| 5503 | self.analyze_lvalue(s.index, explicit_type=s.index_type is not None, is_index_var=True) |
| 5504 | if s.index_type: |
| 5505 | if self.is_classvar(s.index_type): |
| 5506 | self.fail_invalid_classvar(s.index) |
| 5507 | allow_tuple_literal = isinstance(s.index, TupleExpr) |
| 5508 | analyzed = self.anal_type(s.index_type, allow_tuple_literal=allow_tuple_literal) |
| 5509 | if analyzed is not None: |
| 5510 | self.store_declared_types(s.index, analyzed) |
| 5511 | s.index_type = analyzed |
| 5512 | |
| 5513 | self.loop_depth[-1] += 1 |
| 5514 | with self.inside_except_star_block_set(value=False, entering_loop=True): |
| 5515 | self.visit_block(s.body) |
| 5516 | self.loop_depth[-1] -= 1 |
| 5517 | self.visit_block_maybe(s.else_body) |
| 5518 | |
| 5519 | def visit_break_stmt(self, s: BreakStmt) -> None: |
| 5520 | self.statement = s |
nothing calls this directly
no test coverage detected