Files
oxc-project__oxc/crates/oxc_react_compiler/tests/snapshots/repro-scope-missing-mutable-range.snap
Boshen ecab5f7d2b fix(react-compiler): remove redundant compound assignment expressions (#25642)
Removes synthetic expression statements emitted after captured compound assignments when their value is unused. The lowering-created context load is tagged so analysis retains it, while codegen can omit it after the lvalue is pruned. Consumed assignment results are preserved.

Validated with `env -u NO_COLOR just ready`.

AI assistance: Codex was used to investigate, implement, and validate this change.
2026-08-14 05:25:06 +00:00

31 lines
681 B
Plaintext

---
source: crates/oxc_react_compiler/tests/snapshot.rs
input_file: crates/oxc_react_compiler/fixtures/repro-scope-missing-mutable-range.js
---
import { c as _c } from "react/compiler-runtime";
function HomeDiscoStoreItemTileRating(props) {
const $ = _c(4);
const item = useFragment();
let count;
if ($[0] !== item?.aggregates) {
count = 0;
const aggregates = item?.aggregates || [];
aggregates.forEach((aggregate) => {
count = count + (aggregate.count || 0);
});
$[0] = item?.aggregates;
$[1] = count;
} else {
count = $[1];
}
let t0;
if ($[2] !== count) {
t0 = <Text>{count}</Text>;
$[2] = count;
$[3] = t0;
} else {
t0 = $[3];
}
return t0;
}