Skip to content

Conversation

@josephsavona
Copy link
Member

@josephsavona josephsavona commented Jan 22, 2026

Adds support for value terminals (optional/logical/ternary/sequence) within try/catch clauses.

Try/catch expressions insert maybe-throw terminals after each instruction, but BuildReactiveFunction's value block extraction was not expecting these terminals. The fix is to roughly treat maybe-throw similarly to goto, falling through to the continuation block, but there are a few edge cases to handle.

I've also added extensive tests, including testing that errors correctly flow to the catch handler.

@josephsavona josephsavona requested review from mofeiZ and poteto January 22, 2026 22:56
@meta-cla meta-cla bot added the CLA Signed label Jan 22, 2026
@github-actions github-actions bot added the React Core Team Opened by a member of the React Core Team label Jan 22, 2026
@josephsavona josephsavona marked this pull request as draft January 23, 2026 00:16
@josephsavona josephsavona changed the title [compiler] Support optional/logical/etc within try/catch [wip][compiler] Support optional/logical/etc within try/catch Jan 23, 2026
@josephsavona josephsavona force-pushed the worktree-2026-01-22-11-41-02-orange-river branch 2 times, most recently from ffa4d6e to 79e188d Compare January 24, 2026 00:07
@josephsavona josephsavona force-pushed the worktree-2026-01-22-11-41-02-orange-river branch from 79e188d to 20c7514 Compare January 24, 2026 00:34
Control-flow expressions such as logicals, optionals, and ternaries were not supported within try/catch. BuildReactiveFunction recursively traversed these terminals, and was not expecting their condition blocks to end in a maybe-throw terminal, which can occur due to the try/catch. The fix here is to treat the maybe-throw similarly to goto, passing through to the continuation block.
@josephsavona josephsavona force-pushed the worktree-2026-01-22-11-41-02-orange-river branch from 20c7514 to b58f60f Compare January 24, 2026 00:44
@josephsavona josephsavona force-pushed the worktree-2026-01-22-11-41-02-orange-river branch from 415755c to 037094a Compare January 26, 2026 18:02
@josephsavona josephsavona changed the title [wip][compiler] Support optional/logical/etc within try/catch [compiler] Support optional/logical/etc within try/catch Jan 26, 2026
@josephsavona josephsavona marked this pull request as ready for review January 26, 2026 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed React Core Team Opened by a member of the React Core Team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant