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: MypyFile)
| 13 | |
| 14 | |
| 15 | def free_tree(tree: MypyFile) -> None: |
| 16 | """Free all the ASTs associated with a module. |
| 17 | |
| 18 | This needs to be done recursively, since symbol tables contain |
| 19 | references to definitions, so those won't be freed but we want their |
| 20 | contents to be. |
| 21 | """ |
| 22 | tree.accept(TreeFreer()) |
| 23 | tree.defs.clear() |
no test coverage detected
searching dependent graphs…