Replace modules with newly builds versions. Retain the identities of externally visible AST nodes in the old ASTs so that references to the affected modules from other modules will still be valid (unless something was deleted or replaced with an incompatible definition, in which cas
(
manager: BuildManager,
graph: dict[str, State],
old_modules: dict[str, MypyFile | None],
new_modules: dict[str, MypyFile | None],
)
| 809 | |
| 810 | |
| 811 | def replace_modules_with_new_variants( |
| 812 | manager: BuildManager, |
| 813 | graph: dict[str, State], |
| 814 | old_modules: dict[str, MypyFile | None], |
| 815 | new_modules: dict[str, MypyFile | None], |
| 816 | ) -> None: |
| 817 | """Replace modules with newly builds versions. |
| 818 | |
| 819 | Retain the identities of externally visible AST nodes in the |
| 820 | old ASTs so that references to the affected modules from other |
| 821 | modules will still be valid (unless something was deleted or |
| 822 | replaced with an incompatible definition, in which case there |
| 823 | will be dangling references that will be handled by |
| 824 | propagate_changes_using_dependencies). |
| 825 | """ |
| 826 | for id in new_modules: |
| 827 | preserved_module = old_modules.get(id) |
| 828 | new_module = new_modules[id] |
| 829 | if preserved_module and new_module is not None: |
| 830 | merge_asts(preserved_module, preserved_module.names, new_module, new_module.names) |
| 831 | manager.modules[id] = preserved_module |
| 832 | graph[id].tree = preserved_module |
| 833 | |
| 834 | |
| 835 | def propagate_changes_using_dependencies( |
no test coverage detected
searching dependent graphs…