Skip to content
Draft
Changes from 1 commit
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
9a4fb5c
Python: Add self-validating CFG tests
tausbn Apr 16, 2026
cc471fd
Python: Add some CFG-validation queries
tausbn Apr 16, 2026
661fd31
Python: Add BasicBlockOrdering test
tausbn Apr 16, 2026
6d829d6
Python: Add NeverReachable test
tausbn Apr 16, 2026
df6d0ca
Python: Add ConsecutiveTimestamps test
tausbn Apr 16, 2026
019e6f2
Python: Make CFG tests parameterised
tausbn Apr 20, 2026
30f28ba
Python: First stab at shared control-flow
tausbn Apr 16, 2026
b5df188
Python: Use fields everywhere in new AST classes
tausbn Apr 20, 2026
6b3a790
Python: Instantiate CFG module fully
tausbn Apr 20, 2026
e66bf87
Python: Instantiate CFG tests with new CFG library
tausbn Apr 20, 2026
4583244
Python: More AstNodeImpl improvements
tausbn Apr 21, 2026
f89a773
Python: Ignore synthetic CFG nodes
tausbn Apr 21, 2026
4e3a633
Python: Support various literals
tausbn Apr 21, 2026
b8bc230
Python: Assert statements
tausbn Apr 21, 2026
4336b07
Python: Function calls
tausbn Apr 21, 2026
999b8f2
Python: Attributes
tausbn Apr 21, 2026
da408d7
Python: assignments
tausbn Apr 21, 2026
cc09df2
Python: More simple statements
tausbn Apr 21, 2026
9f93d6c
Python: Add `with`
tausbn Apr 21, 2026
5b1de9e
Python: Comprehensions
tausbn Apr 21, 2026
d83d943
Python: More nodes
tausbn Apr 21, 2026
146a3a9
Python: Support `match`
tausbn Apr 21, 2026
cc77f0b
Python: Fix match
tausbn Apr 21, 2026
aaf9cc5
Python: Fix exception issue
tausbn Apr 21, 2026
655f84e
Python: Handle dict unpacking in calls
tausbn Apr 21, 2026
8d814e1
WIP
tausbn Apr 21, 2026
498aece
WIP2
tausbn Apr 28, 2026
41b5589
Cleanup, printCFG
tausbn Apr 28, 2026
768bdb5
Python: add pattern nodes
yoff May 4, 2026
5746ed7
python: add consistency checks
yoff May 4, 2026
7912e1b
Python: collapse two-layer AstNodeImpl into a single Ast module
invalid-email-address May 5, 2026
2a04316
Python: compact-renumber FunctionExpr/Lambda defaults
invalid-email-address May 5, 2026
c24e476
Shared CFG: support for-else and while-else loops
invalid-email-address May 5, 2026
c398f92
Python: include try-else in getChild for completion propagation
invalid-email-address May 5, 2026
414ebb9
Python: refactor getChild into per-class OO dispatch
invalid-email-address May 5, 2026
3f6d099
Python: adapt to new shared CFG signature
invalid-email-address May 5, 2026
a2d6d82
Python: dispatch toString/getLocation/getEnclosingCallable per branch
invalid-email-address May 7, 2026
b3f87be
Python: merge T*AstNode wrappers into matching public classes
invalid-email-address May 7, 2026
23e278e
Python: unify Py::BoolExpr handling via TBoolExprPair
invalid-email-address May 7, 2026
b7fa080
Python: index TBlockStmt by Py::StmtList instead of (parent, slot)
invalid-email-address May 7, 2026
e66f53d
Python: document why Assignment subclasses are empty
invalid-email-address May 7, 2026
a66463d
Python: use private-abstract + final-alias pattern for AstNode
invalid-email-address May 7, 2026
5e86f5b
Python: introduce TStmt union via newtype-branch alias
invalid-email-address May 7, 2026
8d4fd93
Python: simplify TBlockStmt char pred via exclusion list
invalid-email-address May 7, 2026
e9f14fc
Python: introduce TExpr union via newtype-branch alias
invalid-email-address May 7, 2026
2c43ca9
Python: use newtype-branch constructors in characteristic predicates
invalid-email-address May 7, 2026
9bdae5a
Python: project via as* helpers outside characteristic predicates
invalid-email-address May 7, 2026
93bd4e3
Python: add CFG-binding gap tests (red)
Copilot May 12, 2026
bd20042
Python: wire AnnAssign into the shared CFG (green)
Copilot May 12, 2026
17c6d10
Python: wire parameters into the shared CFG (C# pattern)
Copilot May 12, 2026
8918067
Python: wire import-statement bindings into the shared CFG (green)
Copilot May 12, 2026
f17a662
Python: wire match-pattern bindings into the shared CFG (green)
Copilot May 12, 2026
3cf3420
Python: wire PEP 695 type parameters into the shared CFG (green)
yoff May 18, 2026
a249d58
Python: test dead bindings under no-raise CFG abstraction
yoff May 18, 2026
8f0e3c8
Python: introduce new-CFG facade
yoff May 18, 2026
780995c
Python: introduce shared-SSA adapter on the new CFG
yoff May 18, 2026
2257d1e
Python: fix augstore for the new CFG and add store/load test
yoff May 18, 2026
e74f8c9
Python: bring Cfg.qll's facade to API parity with Flow.qll
yoff May 18, 2026
47532ec
Python: qualify Flow.qll's AST references with Py:: prefix
yoff May 18, 2026
2741492
Python: extend new SSA with ESSA-shaped adapter + baseline comparison…
yoff May 18, 2026
ccd60a5
Python: SSA: handle closure variables via per-scope entry defs
yoff May 19, 2026
d308c88
Python: SSA adapter: add MultiAssignmentDefinition, definedBy, useOfDef
yoff May 19, 2026
f939854
Python: remove getAFlowNode() — bridge AST→CFG only via CFG-side getN…
yoff May 21, 2026
1037f52
Python: migrate dataflow library to new CFG + shared SSA
yoff May 26, 2026
8f6c246
Python: update dataflow tests for new CFG + shared SSA
yoff May 26, 2026
438092f
Python: model `from X import *` as uncertain SSA writes
yoff May 26, 2026
0a4ddf8
Python: treat augmented-assignment targets as both load and store
yoff May 26, 2026
6365b72
Python: drop legacy essa import from ImportResolution
yoff May 26, 2026
81b2f34
Python: adapt AstNodeImpl to upstream shared-CFG signature changes
yoff May 26, 2026
d5f1e09
Python: migrate remaining query-side files to new Cfg::
yoff May 26, 2026
2d997aa
Python: omit PEP 695 type-param names from FunctionDefExpr/ClassDefEx…
yoff May 26, 2026
b8c5e25
Python: migrate src queries to new shared CFG types + reformat
yoff May 26, 2026
ba0f24f
Python: canonicalize CFG nodes for dataflow
yoff May 28, 2026
04b130f
Python: fix library-test compile errors and rebless after CFG migration
yoff May 28, 2026
de77449
Python: migrate remaining tests off getAFlowNode() and fix star-impor…
yoff May 28, 2026
9696ee9
Python: migrate two more test queries off legacy CFG types
yoff May 28, 2026
cf28c32
Python: rebless toString churn from shared-CFG migration
yoff May 28, 2026
1bcaa56
Python: rebless second round after shared-CFG dataflow migration
yoff May 28, 2026
2e82990
Python: rebless CONSISTENCY queries + revert LongPath
yoff May 28, 2026
ef74ec1
Python: fold in evaluation-order review-comment fixes from main
yoff May 28, 2026
03c1f77
Python: revert spurious Py2 hidden-test rebless
yoff May 29, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Python: Add with
Co-authored-by: yoff <yoff@github.com>
  • Loading branch information
tausbn and yoff committed May 28, 2026
commit 9f93d6c902b6ac404a8c735830ce0336752fa0f7
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,19 @@ private module Ast {
ExprNode getCause() { result.asExpr() = raise.getCause() }
}

/** A `with` statement. */
class WithNode extends StmtNode {
private Py::With withStmt;

WithNode() { withStmt = this.asStmt() }

ExprNode getContextExpr() { result.asExpr() = withStmt.getContextExpr() }

ExprNode getOptionalVars() { result.asExpr() = withStmt.getOptionalVars() }

StmtListNode getBody() { result.asStmtList() = withStmt.getBody() }
}

/** A `break` statement. */
class BreakNode extends StmtNode {
BreakNode() { this.asStmt() instanceof Py::Break }
Expand Down Expand Up @@ -650,6 +663,15 @@ module AstSigImpl implements AstSig<Py::Location> {
// Delete: targets left to right
result = n.(Ast::DeleteNode).getTarget(index)
or
// With: context expr (0), optional vars (1), body (2)
exists(Ast::WithNode w | w = n |
index = 0 and result = w.getContextExpr()
or
index = 1 and result = w.getOptionalVars()
or
index = 2 and result = w.getBody()
)
or
// ThrowStmt (raise): the exception (0), the cause (1)
exists(Ast::RaiseNode r | r = n |
index = 0 and result = r.getException()
Expand Down