refactor(semantic): eliminate manual current_node_ix manipulation in try statements#14858
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. |
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the control flow graph (CFG) construction for try-catch-finally statements by eliminating manual manipulation of current_node_ix. The key improvement is moving the creation of after_try_statement_block_ix inside conditional branches where it's actually needed, rather than creating it unconditionally upfront.
- Simplified CFG construction logic by removing direct
current_node_ixassignments within catch and finally block handlers - Consolidated block creation to only occur when needed based on the presence of catch/finally clauses
- Added explicit handling for try statements without catch or finally blocks
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/oxc_semantic/src/builder.rs | Refactored try statement CFG construction to conditionally create blocks and removed manual current_node_ix manipulation |
| crates/oxc_semantic/tests/integration/snapshots/labelled_try_break.snap | Updated CFG edge ordering in snapshot |
| crates/oxc_semantic/tests/integration/snapshots/labeled_block_break.snap | Updated CFG edge ordering in snapshot |
| crates/oxc_semantic/tests/integration/snapshots/function_in_finally.snap | Updated CFG edge ordering in snapshot |
| crates/oxc_semantic/tests/integration/snapshots/do_while_break.snap | Updated CFG edge ordering in snapshot |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
CodSpeed Performance ReportMerging #14858 will not alter performanceComparing Summary
|
31b0fd4 to
7d5b995
Compare
Merge activity
|
…try statements (#14858) fixes the `TODO` comments left in the code
7d5b995 to
109f452
Compare

fixes the
TODO comments left in the code