mirror of
https://github.com/oxc-project/oxc.git
synced 2026-09-14 19:36:11 +08:00
48e917fcba
Preserve tagged-template call, aliasing, and mutation effects instead of assuming no-substitution tags are primitive or pure. Execute opaque or effectful tags unconditionally while retaining memoization only when a configured signature proves a read-only pure call and safe return. AI-assisted investigation and implementation; reviewed and understood by the contributor.
32 lines
731 B
Plaintext
32 lines
731 B
Plaintext
---
|
|
source: crates/oxc_react_compiler/tests/snapshot.rs
|
|
input_file: crates/oxc_react_compiler/fixtures/readonly-object-method-calls-mutable-lambda.js
|
|
---
|
|
import { c as _c } from "react/compiler-runtime";
|
|
import { useFragment } from "shared-runtime";
|
|
function Component(props) {
|
|
const $ = _c(2);
|
|
const x = makeObject();
|
|
const user = useFragment(graphql`
|
|
fragment Component_user on User {
|
|
name
|
|
}
|
|
`, props.user);
|
|
const posts = user.timeline.posts.edges.nodes.map((node) => {
|
|
x.y = true;
|
|
return <Post post={node} />;
|
|
});
|
|
posts.push({});
|
|
const count = posts.length;
|
|
foo(count);
|
|
let t0;
|
|
if ($[0] !== posts) {
|
|
t0 = <>{posts}</>;
|
|
$[0] = posts;
|
|
$[1] = t0;
|
|
} else {
|
|
t0 = $[1];
|
|
}
|
|
return t0;
|
|
}
|