(graph: Graph, scc: list[str], patches: Patches)
| 252 | |
| 253 | |
| 254 | def process_functions(graph: Graph, scc: list[str], patches: Patches) -> None: |
| 255 | # Process functions. |
| 256 | all_targets = [] |
| 257 | for module in scc: |
| 258 | tree = graph[module].tree |
| 259 | assert tree is not None |
| 260 | # In principle, functions can be processed in arbitrary order, |
| 261 | # but _methods_ must be processed in the order they are defined, |
| 262 | # because some features (most notably partial types) depend on |
| 263 | # order of definitions on self. |
| 264 | # |
| 265 | # There can be multiple generated methods per line. Use target |
| 266 | # name as the second sort key to get a repeatable sort order. |
| 267 | targets = sorted(get_all_leaf_targets(tree), key=lambda x: (x[1].line, x[0])) |
| 268 | all_targets.extend( |
| 269 | [(module, target, node, active_type) for target, node, active_type in targets] |
| 270 | ) |
| 271 | |
| 272 | for module, target, node, active_type in order_by_subclassing(all_targets): |
| 273 | analyzer = graph[module].manager.semantic_analyzer |
| 274 | assert isinstance(node, (FuncDef, OverloadedFuncDef, Decorator)), node |
| 275 | process_top_level_function( |
| 276 | analyzer, graph[module], module, target, node, active_type, patches |
| 277 | ) |
| 278 | |
| 279 | |
| 280 | def process_top_level_function( |
no test coverage detected
searching dependent graphs…