(self)
| 3472 | ) |
| 3473 | |
| 3474 | def finish_passes(self) -> None: |
| 3475 | assert self.tree is not None, "Internal error: method must be called on parsed file only" |
| 3476 | manager = self.manager |
| 3477 | if self.options.semantic_analysis_only: |
| 3478 | return |
| 3479 | t0 = time_ref() |
| 3480 | with self.wrap_context(): |
| 3481 | # Some tests (and tools) want to look at the set of all types. |
| 3482 | options = manager.options |
| 3483 | if options.export_types: |
| 3484 | manager.all_types.update(self.type_map()) |
| 3485 | |
| 3486 | # We should always patch indirect dependencies, even in full (non-incremental) builds, |
| 3487 | # because the cache still may be written, and it must be correct. |
| 3488 | self.patch_indirect_dependencies( |
| 3489 | # Two possible sources of indirect dependencies: |
| 3490 | # * Symbols not directly imported in this module but accessed via an attribute |
| 3491 | # or via a re-export (vast majority of these recorded in semantic analysis). |
| 3492 | # * For each expression type we need to record definitions of type components |
| 3493 | # since "meaning" of the type may be updated when definitions are updated. |
| 3494 | self.tree.module_refs | self.type_checker().module_refs, |
| 3495 | set(self.type_map().values()), |
| 3496 | ) |
| 3497 | |
| 3498 | if self.options.dump_inference_stats: |
| 3499 | dump_type_stats( |
| 3500 | self.tree, |
| 3501 | self.xpath, |
| 3502 | modules=self.manager.modules, |
| 3503 | inferred=True, |
| 3504 | typemap=self.type_map(), |
| 3505 | ) |
| 3506 | manager.report_file(self.tree, self.type_map(), self.options) |
| 3507 | |
| 3508 | self.update_fine_grained_deps(self.manager.fg_deps) |
| 3509 | |
| 3510 | if manager.options.export_ref_info: |
| 3511 | write_undocumented_ref_info( |
| 3512 | self, manager.metastore, manager.options, self.type_map() |
| 3513 | ) |
| 3514 | |
| 3515 | self.free_state() |
| 3516 | if not manager.options.fine_grained_incremental and not manager.options.preserve_asts: |
| 3517 | free_tree(self.tree) |
| 3518 | self.tree.defs.clear() |
| 3519 | self.time_spent_us += time_spent_us(t0) |
| 3520 | |
| 3521 | def free_state(self) -> None: |
| 3522 | if self._type_checker: |
no test coverage detected