Repository navigation
feat: control-flow graphs - #12
Merged
Merged
Conversation
Acceptance tests for per-function CFGs over PyHIR: explicit Branch, Jump, Return, Raise and ForEach terminators, predecessors and successors in block order, reachability, back edges, integrity checks, loop control errors, and the CFG as a function-level analysis. Adds the PyHIR control-flow node tests. Co-Authored-By: Claude Fable 5.1 <[email protected]>
PyHIR represents if, while, for, break, continue and raise; scope and import analyses walk the new bodies. The cfg package builds per-function graphs of basic blocks with explicit Branch, Jump, Return, Raise and ForEach terminators, exposes predecessors, successors, reachability and back edges, validates its integrity, and is registered as the cfg.function analysis. Co-Authored-By: Claude Fable 5.1 <[email protected]>
5 tasks done
8 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Opens Phase 3 of
docs/architecture.mdwith §5 CFG.test: define control-flow graph behavior), implementation follows in this PR.If,While,For,Break,ContinueandRaise; scope and import analyses walk the new bodies.coretrace_python.cfg: per-function graphs of basic blocks holding straight-line PyHIR statements and one explicit terminator:Branch,Jump,Return,Raise, orForEachto keep Python's iteration protocol explicit instead of a generic switch. Predecessors, successors, reachability, back edges and integrity checks. Deterministic block order starting atentry.CFGAnalysisis a function-level analysis (cfg.function) computed on demand through the Analysis Manager.break/continueoutside a loop are source-locatedCFGErrors.Not in this PR: exception edges (waiting on
Tryin PyHIR),with, and PyIR lowering over the CFG, which is the next Phase 3 item together withBranch/Jump/Phiinstructions.Closes #11
🤖 Generated with Claude Code