mirror of
https://github.com/oxc-project/oxc.git
synced 2026-09-14 19:36:11 +08:00
4e591ed4ed
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.
27 lines
542 B
Plaintext
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]]
|
|
};
|