(self, b: Block)
| 3254 | # |
| 3255 | |
| 3256 | def visit_block(self, b: Block) -> None: |
| 3257 | if b.is_unreachable: |
| 3258 | # This block was marked as being unreachable during semantic analysis. |
| 3259 | # It turns out any blocks marked in this way are *intentionally* marked |
| 3260 | # as unreachable -- so we don't display an error. |
| 3261 | self.binder.unreachable() |
| 3262 | return |
| 3263 | marked_unreachable = False |
| 3264 | for s in b.body: |
| 3265 | if self.binder.is_unreachable(): |
| 3266 | if self.scope.top_level_function() is None and not marked_unreachable: |
| 3267 | self.mark_unreachable(b.body, after=s) |
| 3268 | marked_unreachable = True |
| 3269 | if not self.should_report_unreachable_issues(): |
| 3270 | break |
| 3271 | if not self.is_noop_for_reachability(s): |
| 3272 | self.msg.unreachable_statement(s) |
| 3273 | break |
| 3274 | else: |
| 3275 | self.accept(s) |
| 3276 | # Clear expression cache after each statement to avoid unlimited growth. |
| 3277 | self.expr_checker.expr_cache.clear() |
| 3278 | |
| 3279 | def should_report_unreachable_issues(self) -> bool: |
| 3280 | return ( |
nothing calls this directly
no test coverage detected