Major fixes and new features
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2025-09-25 15:51:48 +09:00
parent dd7349bb4c
commit ddce9f5125
5586 changed files with 1470941 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
"""Generic node traverser visitor"""
from __future__ import annotations
from mypy.nodes import Block, MypyFile
from mypy.traverser import TraverserVisitor
class TreeFreer(TraverserVisitor):
def visit_block(self, block: Block) -> None:
super().visit_block(block)
block.body.clear()
def free_tree(tree: MypyFile) -> None:
"""Free all the ASTs associated with a module.
This needs to be done recursively, since symbol tables contain
references to definitions, so those won't be freed but we want their
contents to be.
"""
tree.accept(TreeFreer())
tree.defs.clear()