Files
oxc-project__oxc/crates/oxc_react_compiler/tests/snapshots/constant-propagation-compound-assignment.snap
Boshen e3683f29d8 fix(react_compiler): materialize compound assignment reads (#25450)
Materializes identifier reads before compound-assignment binary operations so constant propagation matches the upstream React Compiler. AI-assisted.
2026-08-09 16:25:11 +00:00

28 lines
571 B
Plaintext

---
source: crates/oxc_react_compiler/tests/snapshot.rs
input_file: crates/oxc_react_compiler/fixtures/constant-propagation-compound-assignment.tsx
---
import { c as _c } from "react/compiler-runtime";
function Component(t0) {
const $ = _c(3);
const { suffix, offset } = t0;
let text = "prefix";
let count = 10;
if (suffix) {
text = "prefix" + suffix;
}
if (offset) {
count = 10 - offset;
}
let t1;
if ($[0] !== count || $[1] !== text) {
t1 = <div>{text}: {count}</div>;
$[0] = count;
$[1] = text;
$[2] = t1;
} else {
t1 = $[2];
}
return t1;
}