Files
oxc-project__oxc/crates/oxc_react_compiler/tests/snapshots/ts-enum-inline-switch-case.snap
Boshen b0e6c2574c fix(react-compiler): match upstream inline enum handling (#25672)
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.
2026-08-15 03:45:50 +00:00

38 lines
751 B
Plaintext

---
source: crates/oxc_react_compiler/tests/snapshot.rs
input_file: crates/oxc_react_compiler/fixtures/ts-enum-inline-switch-case.tsx
---
import { c as _c } from "react/compiler-runtime";
function Component(props) {
const $ = _c(2);
enum Action {
Select
}
switch (props.action) {
case String(Action.Select): {
let t0;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
t0 = <span>selected</span>;
$[0] = t0;
} else {
t0 = $[0];
}
return t0;
}
default: {
let t0;
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
t0 = <span>unknown</span>;
$[1] = t0;
} else {
t0 = $[1];
}
return t0;
}
}
}
export const FIXTURE_ENTRYPOINT = {
fn: Component,
params: [{ action: "0" }]
};