Files
oxc-project__oxc/crates/oxc_react_compiler/tests/snapshots/compound-assignment-context-result.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

29 lines
612 B
Plaintext

---
source: crates/oxc_react_compiler/tests/snapshot.rs
input_file: crates/oxc_react_compiler/fixtures/compound-assignment-context-result.js
---
import { c as _c } from "react/compiler-runtime";
function Component(t0) {
const $ = _c(2);
const { values } = t0;
let count;
if ($[0] !== values) {
count = 0;
values.forEach((value) => {
count = count + value;
count = count + value;
const result = count;
console.log(result);
});
$[0] = values;
$[1] = count;
} else {
count = $[1];
}
return count;
}
export const FIXTURE_ENTRYPOINT = {
fn: Component,
params: [{ values: [1, 2] }]
};