-
-
Notifications
You must be signed in to change notification settings - Fork 713
fix(semantic): add condition basic blocks to CFG for logical expressions #14671
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(semantic): add condition basic blocks to CFG for logical expressions #14671
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
CodSpeed Performance ReportMerging #14671 will not alter performanceComparing Summary
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR enhances the control flow graph (CFG) generation for logical expressions by adding explicit condition basic blocks. Previously, logical expressions (&&, ||, ??) and their assignment operator equivalents (&&=, ||=, ??=) lacked distinct condition nodes in the CFG, which reduced traceability and accuracy.
Key changes:
- Added condition basic blocks before evaluating left operands of logical expressions
- Extended the same treatment to logical assignment operators
- Updated CFG snapshots to reflect the new basic block structure
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| crates/oxc_semantic/src/builder.rs | Core implementation adding condition block creation and edge connections for logical expressions and assignments |
| crates/oxc_semantic/tests/integration/snapshots/*.snap | Updated test snapshots reflecting additional basic blocks and edges in CFG output |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Merge activity
|
…ons (#14671) Add explicit condition basic blocks in the control flow graph for logical expressions and logical assignment operators. This improves CFG accuracy by representing condition evaluation as distinct nodes. Changes: - Create condition basic blocks before evaluating left operands of logical expressions (&&, ||, ??) - Record and attach AST nodes to condition blocks for better traceability - Add edges from preceding blocks to condition blocks - Apply same treatment to logical assignment operators (&&=, ||=, ??=) This affects CFG generation for: - LogicalExpression nodes - AssignmentExpression nodes with logical operators
2ce7edd to
cdf2d07
Compare

Add explicit condition basic blocks in the control flow graph for logical
expressions and logical assignment operators. This improves CFG accuracy by
representing condition evaluation as distinct nodes.
Changes:
This affects CFG generation for: