mirror of
https://github.com/oxc-project/oxc.git
synced 2026-09-14 19:36:11 +08:00
0e5642162e
The fixture corpus mixed the canonical `@key:value` pragma form with three legacy forms — `@key(value)`, `@key="value"`, and `@key value` — that upstream's `splitPragma` silently ignores or mis-reads. This rewrites the 9 affected fixtures to the canonical `@key:value` form so there is only one shape to parse, and drops the space-form tolerance from `parse_pragma` accordingly. ## Normalized headers | fixture | before | after | |---|---|---| | `no-cache-slots-no-import` | `@compilationMode(all)` | `@compilationMode:"all"` | | `repro-bailout-nopanic-shouldnt-outline` | `@panicThreshold(none)` | `@panicThreshold:"none"` | | `fbt/error.todo-fbt-plural-in-expression-container` | `@compilationMode(infer)` | `@compilationMode:"infer"` | | `meta-isms/repro-cx-namespace-assigned-to-temporary` | `@customMacros(cx)` | `@customMacros:"cx"` | | `target-flag` | `@target="18"` | `@target:"18"` | | `target-flag-meta-internal` | `@target="donotuse_meta_internal"` | `@target:"donotuse_meta_internal"` | | `immutable-hooks` | `@enableAssumeHooksFollowRulesOfReact true` | `@enableAssumeHooksFollowRulesOfReact:true` | | `ref-current-aliased-no-added-to-dep` | `@validateRefAccessDuringRender false` | `@validateRefAccessDuringRender:false` | | `ref-current-field-not-added-to-dep` | `@validateRefAccessDuringRender false` | `@validateRefAccessDuringRender:false` | ## Behavior-preserving Every regenerated snapshot differs only in the echoed header comment (codegen preserves the leading comment), plus one +1 byte-offset shift in the `fbt` diagnostic from the comment being one character longer. No compiled output changed, and no other fixture is affected by the parser simplification.
29 lines
540 B
Plaintext
29 lines
540 B
Plaintext
---
|
|
source: crates/oxc_react_compiler/tests/snapshot.rs
|
|
input_file: crates/oxc_react_compiler/fixtures/immutable-hooks.js
|
|
---
|
|
import { c as _c } from "react/compiler-runtime";
|
|
// @enableAssumeHooksFollowRulesOfReact:true
|
|
function Component(props) {
|
|
const $ = _c(3);
|
|
let t0;
|
|
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
t0 = {};
|
|
$[0] = t0;
|
|
} else {
|
|
t0 = $[0];
|
|
}
|
|
const x = t0;
|
|
const y = useFoo(x);
|
|
bar(x, y);
|
|
let t1;
|
|
if ($[1] !== y) {
|
|
t1 = [x, y];
|
|
$[1] = y;
|
|
$[2] = t1;
|
|
} else {
|
|
t1 = $[2];
|
|
}
|
|
return t1;
|
|
}
|