|
143 | 143 |
|
144 | 144 | from mypy import errorcodes as codes |
145 | 145 | from mypy.config_parser import get_config_module_names, parse_mypy_comments |
146 | | -from mypy.fixup import node_fixer |
| 146 | +from mypy.fixer_state import fixer_state |
| 147 | +from mypy.fixup import NodeFixer |
147 | 148 | from mypy.freetree import free_tree |
148 | 149 | from mypy.fscache import FileSystemCache |
149 | 150 | from mypy.known_modules import get_known_modules, reset_known_modules_cache |
@@ -813,11 +814,9 @@ def __init__( |
813 | 814 | self.version_id = version_id |
814 | 815 | self.modules: dict[str, MypyFile] = {} |
815 | 816 | # Share same modules dictionary with the global fixer state. |
816 | | - node_fixer.modules = node_fixer.type_fixer.modules = self.modules |
817 | 817 | # We need to set allow_missing when doing a fine-grained cache |
818 | 818 | # load because we need to gracefully handle missing modules. |
819 | | - allow_missing = self.options.use_fine_grained_cache |
820 | | - node_fixer.allow_missing = node_fixer.type_fixer.allow_missing = allow_missing |
| 819 | + fixer_state.node_fixer = NodeFixer(self.modules, self.options.use_fine_grained_cache) |
821 | 820 | self.import_map: dict[str, set[str]] = {} |
822 | 821 | self.missing_modules: dict[str, int] = {} |
823 | 822 | self.fg_deps_meta: dict[str, FgDepMeta] = {} |
@@ -2820,8 +2819,9 @@ def load_tree(self, temporary: bool = False) -> None: |
2820 | 2819 | def fix_cross_refs(self) -> None: |
2821 | 2820 | assert self.tree is not None, "Internal error: method must be called on parsed file only" |
2822 | 2821 | # Do initial lightweight pass fixing TypeInfos and module cross-references. |
2823 | | - node_fixer.visit_symbol_table(self.tree.names) |
2824 | | - type_fixer = node_fixer.type_fixer |
| 2822 | + assert fixer_state.node_fixer is not None |
| 2823 | + fixer_state.node_fixer.visit_symbol_table(self.tree.names) |
| 2824 | + type_fixer = fixer_state.node_fixer.type_fixer |
2825 | 2825 | if instance_cache.str_type is not None: |
2826 | 2826 | instance_cache.str_type.accept(type_fixer) |
2827 | 2827 | if instance_cache.function_type is not None: |
|
0 commit comments