mirror of
https://github.com/oxc-project/oxc.git
synced 2026-09-14 19:36:11 +08:00
b0e6c2574c
Preserve inline TypeScript enums as opaque pass-through HIR nodes, matching upstream React Compiler behavior. Apply Oxc-specific raw AST reference renaming, and skip compilation when passthrough would hide nested captures or flatten block-local bindings. AI-assisted: Codex was used to implement and validate this change.
37 lines
729 B
Plaintext
37 lines
729 B
Plaintext
---
|
|
source: crates/oxc_react_compiler/tests/snapshot.rs
|
|
input_file: crates/oxc_react_compiler/fixtures/ts-enum-inline-member-mutation.tsx
|
|
---
|
|
import { c as _c } from "react/compiler-runtime";
|
|
function Child(props) {
|
|
const $ = _c(2);
|
|
let t0;
|
|
if ($[0] !== props.items.length) {
|
|
t0 = <span>{props.items.length}</span>;
|
|
$[0] = props.items.length;
|
|
$[1] = t0;
|
|
} else {
|
|
t0 = $[1];
|
|
}
|
|
return t0;
|
|
}
|
|
function Component(props) {
|
|
const $ = _c(2);
|
|
enum Result {
|
|
Length = props.items.push(1)
|
|
}
|
|
let t0;
|
|
if ($[0] !== props.items) {
|
|
t0 = <Child items={props.items} />;
|
|
$[0] = props.items;
|
|
$[1] = t0;
|
|
} else {
|
|
t0 = $[1];
|
|
}
|
|
return t0;
|
|
}
|
|
export const FIXTURE_ENTRYPOINT = {
|
|
fn: Component,
|
|
params: [{ items: [] }]
|
|
};
|