(stmt: Stmt)
| 883 | |
| 884 | |
| 885 | def stmt_escapes(stmt: Stmt) -> bool: |
| 886 | if isinstance(stmt, BlockStmt): |
| 887 | return stmt_list_escapes(stmt.body) |
| 888 | elif isinstance(stmt, SimpleStmt): |
| 889 | for tkn in stmt.contents: |
| 890 | if tkn.text == "DECREF_INPUTS": |
| 891 | return True |
| 892 | d: dict[SimpleStmt, EscapingCall] = {} |
| 893 | escaping_call_in_simple_stmt(stmt, d) |
| 894 | return bool(d) |
| 895 | elif isinstance(stmt, IfStmt): |
| 896 | if stmt.else_body and stmt_escapes(stmt.else_body): |
| 897 | return True |
| 898 | return stmt_escapes(stmt.body) |
| 899 | elif isinstance(stmt, MacroIfStmt): |
| 900 | if stmt.else_body and stmt_list_escapes(stmt.else_body): |
| 901 | return True |
| 902 | return stmt_list_escapes(stmt.body) |
| 903 | elif isinstance(stmt, ForStmt): |
| 904 | return stmt_escapes(stmt.body) |
| 905 | elif isinstance(stmt, WhileStmt): |
| 906 | return stmt_escapes(stmt.body) |
| 907 | else: |
| 908 | assert False, "Unexpected statement type" |
| 909 | |
| 910 | def stmt_has_jump_on_unpredictable_path_body(stmts: list[Stmt] | None, branches_seen: int) -> tuple[bool, int]: |
| 911 | if not stmts: |
no test coverage detected
searching dependent graphs…