Defer current analysis target to be analyzed again. This must be called if something in the current target is incomplete or has a placeholder node. However, this must *not* be called during the final analysis iteration! Instead, an error should be generated. Often 'p
(self, debug_context: Context | None = None, force_progress: bool = False)
| 7291 | self.tvar_scope = old_scope |
| 7292 | |
| 7293 | def defer(self, debug_context: Context | None = None, force_progress: bool = False) -> None: |
| 7294 | """Defer current analysis target to be analyzed again. |
| 7295 | |
| 7296 | This must be called if something in the current target is |
| 7297 | incomplete or has a placeholder node. However, this must *not* |
| 7298 | be called during the final analysis iteration! Instead, an error |
| 7299 | should be generated. Often 'process_placeholder' is a good |
| 7300 | way to either defer or generate an error. |
| 7301 | |
| 7302 | NOTE: Some methods, such as 'anal_type', 'mark_incomplete' and |
| 7303 | 'record_incomplete_ref', call this implicitly, or when needed. |
| 7304 | They are usually preferable to a direct defer() call. |
| 7305 | """ |
| 7306 | assert not self.final_iteration, "Must not defer during final iteration" |
| 7307 | if force_progress: |
| 7308 | # Usually, we report progress if we have replaced a placeholder node |
| 7309 | # with an actual valid node. However, sometimes we need to update an |
| 7310 | # existing node *in-place*. For example, this is used by type aliases |
| 7311 | # in context of forward references and/or recursive aliases, and in |
| 7312 | # similar situations (recursive named tuples etc). |
| 7313 | self.progress = True |
| 7314 | self.deferred = True |
| 7315 | # Store debug info for this deferral. |
| 7316 | line = ( |
| 7317 | debug_context.line if debug_context else self.statement.line if self.statement else -1 |
| 7318 | ) |
| 7319 | self.deferral_debug_context.append((self.cur_mod_id, line)) |
| 7320 | |
| 7321 | def track_incomplete_refs(self) -> Tag: |
| 7322 | """Return tag that can be used for tracking references to incomplete names.""" |
no test coverage detected