Commit 4d2296d
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 aaa3b36 commit 4d2296d
1 file changed
Lines changed: 58 additions & 3 deletions
File tree
Lines changed: 58 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
211 | 211 | | |
212 | 212 | | |
213 | 213 | | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
214 | 239 | | |
215 | 240 | | |
216 | 241 | | |
| |||
1549 | 1574 | | |
1550 | 1575 | | |
1551 | 1576 | | |
1552 | | - | |
| 1577 | + | |
| 1578 | + | |
| 1579 | + | |
| 1580 | + | |
| 1581 | + | |
1553 | 1582 | | |
1554 | 1583 | | |
1555 | 1584 | | |
1556 | 1585 | | |
1557 | 1586 | | |
| 1587 | + | |
| 1588 | + | |
| 1589 | + | |
| 1590 | + | |
| 1591 | + | |
1558 | 1592 | | |
1559 | 1593 | | |
1560 | 1594 | | |
1561 | 1595 | | |
1562 | 1596 | | |
1563 | 1597 | | |
1564 | | - | |
| 1598 | + | |
| 1599 | + | |
| 1600 | + | |
| 1601 | + | |
| 1602 | + | |
1565 | 1603 | | |
1566 | 1604 | | |
1567 | 1605 | | |
| |||
1574 | 1612 | | |
1575 | 1613 | | |
1576 | 1614 | | |
1577 | | - | |
| 1615 | + | |
| 1616 | + | |
| 1617 | + | |
| 1618 | + | |
| 1619 | + | |
1578 | 1620 | | |
1579 | 1621 | | |
1580 | 1622 | | |
| 1623 | + | |
| 1624 | + | |
| 1625 | + | |
1581 | 1626 | | |
1582 | 1627 | | |
1583 | 1628 | | |
| |||
1671 | 1716 | | |
1672 | 1717 | | |
1673 | 1718 | | |
| 1719 | + | |
| 1720 | + | |
| 1721 | + | |
| 1722 | + | |
| 1723 | + | |
| 1724 | + | |
| 1725 | + | |
| 1726 | + | |
| 1727 | + | |
| 1728 | + | |
1674 | 1729 | | |
1675 | 1730 | | |
1676 | 1731 | | |
| |||
0 commit comments