Files
oxc-project__oxc/crates/oxc_react_compiler/tests/snapshots/destructure-array-param-to-context-var.snap
Boshen 4e591ed4ed fix(react_compiler): support destructured context parameters (#25724)
Fix destructured function and rest parameters that become context variables by lowering them through temporaries before `StoreContext`. This avoids inconsistent `Destructure`/context HIR and compiles supported components correctly.

Validated with `just ready` and runtime equivalence checks against React 19.2.1's compiler runtime.

AI usage: Implemented with assistance from OpenAI Codex.
2026-08-16 03:04:17 +00:00

27 lines
542 B
Plaintext

---
source: crates/oxc_react_compiler/tests/snapshot.rs
input_file: crates/oxc_react_compiler/fixtures/destructure-array-param-to-context-var.js
---
import { c as _c } from "react/compiler-runtime";
import { identity } from "shared-runtime";
function Component(t0) {
const $ = _c(2);
let t1;
if ($[0] !== t0) {
const [t2] = t0;
let x = t2;
x = identity(x);
const read = () => x;
t1 = read();
$[0] = t0;
$[1] = t1;
} else {
t1 = $[1];
}
return t1;
}
export const FIXTURE_ENTRYPOINT = {
fn: Component,
params: [[42]]
};