Files
magic-akariandGitHub f1c93f2a9d fix(es/react-compiler): Correct catch and parameter scope resolution (#11985)
**Description:**

Fixes React Compiler scope conversion for catch and parameter bindings.

The bug from #11982 was exposed by compiling an async `useCallback` with
`catch (error) { return error; }`: the converted scope info did not
consistently model the catch parameter as a value binding, so references
to the catch value could be left unresolved and produce incorrect
compiled output.

This PR updates `SemanticBuilder` so declaration-space flags carry
value-ness explicitly, with marker flags (`Param`, `CatchVariable`,
`FunctionExpression`) layered onto value-bearing flags. Catch bindings
stay in the catch scope and can be resolved from catch bodies and catch
parameter initializers.

It also models parameter initializers and destructuring patterns with a
temporary internal resolution scope. Function, arrow, constructor,
accessor, and catch parameters now resolve references before body
bindings are collected, so defaults and computed pattern keys observe
the intended lexical visibility: function expression names and parameter
bindings are visible, while body bindings do not shadow parameter
initialization. These internal parameter scopes are skipped when
emitting React Compiler `ScopeInfo`, preserving the public scope tree.

Coverage includes:
- the async `useCallback` catch-binding compile-pass fixture for #11982
- catch destructuring with computed keys and initializer references
- function parameter defaults resolving to outer bindings, later
parameters, or named function expressions
- named function expressions shadowed by params or body `var`
declarations

**Related issue:**

- Closes #11982
2026-07-06 07:49:00 +09:00
..