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.
10 lines
320 B
JavaScript
10 lines
320 B
JavaScript
// @enableAssumeHooksFollowRulesOfReact:true
|
|
function Component(props) {
|
|
const x = {};
|
|
// In enableAssumeHooksFollowRulesOfReact mode hooks freeze their inputs and return frozen values
|
|
const y = useFoo(x);
|
|
// Thus both x and y are frozen here, and x can be independently memoized
|
|
bar(x, y);
|
|
return [x, y];
|
|
}
|