18 releases (7 breaking)
Uses new Rust 2024
| 0.8.0-pre.10 | Nov 26, 2025 |
|---|---|
| 0.8.0-pre.8 | Jul 24, 2025 |
| 0.4.0 | Mar 9, 2025 |
| 0.3.0 | Dec 28, 2024 |
#5 in #control-flow-graph
Used in 3 crates
48KB
1K
SLoC
Control Flow Graph (CFG) representation for JavaScript.
This crate provides a CFG representation of JavaScript code, serving as an intermediate layer between the Abstract Syntax Tree (AST) and lower-level intermediate representations like TAC and SSA.
Control Flow Graph
A CFG represents a program as a directed graph where:
- Nodes are basic blocks of sequential statements
- Edges represent possible control flow paths
- Each block has one entry point and one exit point (terminator)
Key Types
Func: A function represented as a CFG- [
Cfg]: The control flow graph structure Block: A basic block containing statementsTerm: A terminator (return, jump, branch, etc.)Catch: Exception handler specification
Conversion
This crate converts SWC's JavaScript AST into CFG form, handling:
- Loops (for, while, do-while)
- Conditionals (if-else, switch)
- Exception handling (try-catch-finally)
- Labels and break/continue statements
Modules
Dependencies
~24MB
~386K SLoC