Commit ea0b2e9
Shared CFG: add defaulted getWhileElse/getForeachElse/getCatchType to AstSig
Adds three new defaulted signature predicates to the shared CFG library:
- getWhileElse / getForeachElse: `else` block of a while/for loop, if
any (used by Python's `while-else` / `for-else` constructs).
- getCatchType: type expression of a catch clause, if any (used by
Python's `except SomeExpr:` where the catch type is a runtime
expression that needs CFG evaluation).
Each predicate defaults to `none()`, so behaviour is unchanged for any
language that doesn't override it (verified by re-running
java/ql/test/library-tests/controlflow/).
The Make0 succession rules are extended:
- WhileStmt/ForeachStmt: route the loop-exit edge through the else
block before reaching the after-position.
- CatchClause: route the matching-evaluation through the type
expression (if present) before reaching the after-value position.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 9c41238 commit ea0b2e9
1 file changed
Lines changed: 59 additions & 4 deletions
File tree
Lines changed: 59 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
224 | 224 | | |
225 | 225 | | |
226 | 226 | | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
227 | 252 | | |
228 | 253 | | |
229 | 254 | | |
| |||
1577 | 1602 | | |
1578 | 1603 | | |
1579 | 1604 | | |
1580 | | - | |
1581 | | - | |
| 1605 | + | |
| 1606 | + | |
| 1607 | + | |
| 1608 | + | |
| 1609 | + | |
| 1610 | + | |
1582 | 1611 | | |
1583 | 1612 | | |
1584 | 1613 | | |
1585 | 1614 | | |
1586 | 1615 | | |
| 1616 | + | |
| 1617 | + | |
| 1618 | + | |
| 1619 | + | |
| 1620 | + | |
1587 | 1621 | | |
1588 | 1622 | | |
1589 | 1623 | | |
1590 | 1624 | | |
1591 | 1625 | | |
1592 | 1626 | | |
1593 | | - | |
| 1627 | + | |
| 1628 | + | |
| 1629 | + | |
| 1630 | + | |
| 1631 | + | |
1594 | 1632 | | |
1595 | 1633 | | |
1596 | 1634 | | |
| |||
1603 | 1641 | | |
1604 | 1642 | | |
1605 | 1643 | | |
1606 | | - | |
| 1644 | + | |
| 1645 | + | |
| 1646 | + | |
| 1647 | + | |
| 1648 | + | |
1607 | 1649 | | |
1608 | 1650 | | |
1609 | 1651 | | |
| 1652 | + | |
| 1653 | + | |
| 1654 | + | |
1610 | 1655 | | |
1611 | 1656 | | |
1612 | 1657 | | |
| |||
1698 | 1743 | | |
1699 | 1744 | | |
1700 | 1745 | | |
| 1746 | + | |
| 1747 | + | |
| 1748 | + | |
| 1749 | + | |
| 1750 | + | |
| 1751 | + | |
| 1752 | + | |
| 1753 | + | |
| 1754 | + | |
| 1755 | + | |
1701 | 1756 | | |
1702 | 1757 | | |
1703 | 1758 | | |
| |||
0 commit comments