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