Skip to content

Comments

refactor(semantic): eliminate manual current_node_ix manipulation in try statements#14858

Merged
graphite-app[bot] merged 1 commit intomainfrom
c/10-21-refactor_semantic_eliminate_manual_current_node_ix_manipulation_in_try_statements
Oct 21, 2025
Merged

refactor(semantic): eliminate manual current_node_ix manipulation in try statements#14858
graphite-app[bot] merged 1 commit intomainfrom
c/10-21-refactor_semantic_eliminate_manual_current_node_ix_manipulation_in_try_statements

Conversation

@camc314
Copy link
Contributor

@camc314 camc314 commented Oct 21, 2025

fixes the TODO​ comments left in the code

Copy link
Contributor Author

camc314 commented Oct 21, 2025


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

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.

@github-actions github-actions bot added A-semantic Area - Semantic C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior labels Oct 21, 2025
@camc314 camc314 marked this pull request as ready for review October 21, 2025 14:13
@camc314 camc314 requested a review from Dunqing as a code owner October 21, 2025 14:13
Copilot AI review requested due to automatic review settings October 21, 2025 14:13
Copy link
Contributor

Copilot AI left a 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 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_ix assignments 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-hq
Copy link

codspeed-hq bot commented Oct 21, 2025

CodSpeed Performance Report

Merging #14858 will not alter performance

Comparing c/10-21-refactor_semantic_eliminate_manual_current_node_ix_manipulation_in_try_statements (7d5b995) with main (f3b75c3)

Summary

✅ 37 untouched

@camc314 camc314 force-pushed the c/10-21-refactor_semantic_eliminate_manual_current_node_ix_manipulation_in_try_statements branch from 31b0fd4 to 7d5b995 Compare October 21, 2025 16:28
@camc314 camc314 added the 0-merge Merge with Graphite Merge Queue label Oct 21, 2025
Copy link
Contributor Author

camc314 commented Oct 21, 2025

Merge activity

…try statements (#14858)

fixes the `TODO`​ comments left in the code
@graphite-app graphite-app bot force-pushed the c/10-21-refactor_semantic_eliminate_manual_current_node_ix_manipulation_in_try_statements branch from 7d5b995 to 109f452 Compare October 21, 2025 16:35
@graphite-app graphite-app bot merged commit 109f452 into main Oct 21, 2025
20 checks passed
@graphite-app graphite-app bot deleted the c/10-21-refactor_semantic_eliminate_manual_current_node_ix_manipulation_in_try_statements branch October 21, 2025 16:41
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Oct 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-semantic Area - Semantic C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant