[compiler] Improve name hints for outlined functions (#34434)

The previous PR added name hints for anonymous functions, but didn't
handle the case of outlined functions. Here we do some cleanup around
function `id` and name hints:
* Make `HIRFunction.id` a ValidatedIdentifierName, which involved some
cleanup of the validation helpers
* Add `HIRFunction.nameHint: string` as a place to store the generated
name hints which are not valid identifiers
* Update Codegen to always use the `id` as the actual function name, and
only use nameHint as part of generating the object+property wrapper for
debug purposes.

This ensures we don't conflate synthesized hints with real function
names. Then, we also update OutlineFunctions to use the function name
_or_ the nameHint as the input to generating a unique identifier. This
isn't quite as nice as the object form since we lose our formatting, but
it's a simple step that gives more context to the developer than `_temp`
does.

Switching to output the object+property lookup form for outlined
functions is a bit more involved, let's do that in a follow-up.

DiffTrain build for [665de2ed28](https://github.com/facebook/react/commit/665de2ed283205fccecda649ae2d66f62983f15f)
This commit is contained in:
josephsavona
2025-09-09 12:20:27 -07:00
parent 7f6493d906
commit abd4b80d40
26 changed files with 213 additions and 189 deletions
+1 -1
View File
@@ -1 +1 @@
19.2.0-native-fb-eda778b8-20250909
19.2.0-native-fb-665de2ed-20250909
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<63996db77ac8b3cfaade56b1ecd62ecf>>
* @generated SignedSource<<4eec5811e289a0cc9597753f42d814e6>>
*/
"use strict";
@@ -404,5 +404,5 @@ __DEV__ &&
exports.useFormStatus = function () {
return resolveDispatcher().useHostTransitionStatus();
};
exports.version = "19.2.0-native-fb-eda778b8-20250909";
exports.version = "19.2.0-native-fb-665de2ed-20250909";
})();
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<e1fbb7250d521a2183c108c556cb1588>>
* @generated SignedSource<<114adfe24e5ff7db94c10c8751b8e702>>
*/
"use strict";
@@ -203,4 +203,4 @@ exports.useFormState = function (action, initialState, permalink) {
exports.useFormStatus = function () {
return ReactSharedInternals.H.useHostTransitionStatus();
};
exports.version = "19.2.0-native-fb-eda778b8-20250909";
exports.version = "19.2.0-native-fb-665de2ed-20250909";
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<e1fbb7250d521a2183c108c556cb1588>>
* @generated SignedSource<<114adfe24e5ff7db94c10c8751b8e702>>
*/
"use strict";
@@ -203,4 +203,4 @@ exports.useFormState = function (action, initialState, permalink) {
exports.useFormStatus = function () {
return ReactSharedInternals.H.useHostTransitionStatus();
};
exports.version = "19.2.0-native-fb-eda778b8-20250909";
exports.version = "19.2.0-native-fb-665de2ed-20250909";
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<fadbbb2a7181c7cc527fa13e391a684b>>
* @generated SignedSource<<8283f5909d9518bf936f9009ae20f199>>
*/
/*
@@ -29580,11 +29580,11 @@ __DEV__ &&
};
(function () {
var isomorphicReactPackageVersion = React.version;
if ("19.2.0-native-fb-eda778b8-20250909" !== isomorphicReactPackageVersion)
if ("19.2.0-native-fb-665de2ed-20250909" !== isomorphicReactPackageVersion)
throw Error(
'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' +
(isomorphicReactPackageVersion +
"\n - react-dom: 19.2.0-native-fb-eda778b8-20250909\nLearn more: https://react.dev/warnings/version-mismatch")
"\n - react-dom: 19.2.0-native-fb-665de2ed-20250909\nLearn more: https://react.dev/warnings/version-mismatch")
);
})();
("function" === typeof Map &&
@@ -29621,10 +29621,10 @@ __DEV__ &&
!(function () {
var internals = {
bundleType: 1,
version: "19.2.0-native-fb-eda778b8-20250909",
version: "19.2.0-native-fb-665de2ed-20250909",
rendererPackageName: "react-dom",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.2.0-native-fb-eda778b8-20250909"
reconcilerVersion: "19.2.0-native-fb-665de2ed-20250909"
};
internals.overrideHookState = overrideHookState;
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
@@ -29773,5 +29773,5 @@ __DEV__ &&
listenToAllSupportedEvents(container);
return new ReactDOMHydrationRoot(initialChildren);
};
exports.version = "19.2.0-native-fb-eda778b8-20250909";
exports.version = "19.2.0-native-fb-665de2ed-20250909";
})();
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<91c15ea4a928cebf1d14a8e95a10db84>>
* @generated SignedSource<<47fe53605b0e750c7434d295233dd627>>
*/
/*
@@ -17388,14 +17388,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) {
};
var isomorphicReactPackageVersion$jscomp$inline_2057 = React.version;
if (
"19.2.0-native-fb-eda778b8-20250909" !==
"19.2.0-native-fb-665de2ed-20250909" !==
isomorphicReactPackageVersion$jscomp$inline_2057
)
throw Error(
formatProdErrorMessage(
527,
isomorphicReactPackageVersion$jscomp$inline_2057,
"19.2.0-native-fb-eda778b8-20250909"
"19.2.0-native-fb-665de2ed-20250909"
)
);
ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
@@ -17417,10 +17417,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
};
var internals$jscomp$inline_2630 = {
bundleType: 0,
version: "19.2.0-native-fb-eda778b8-20250909",
version: "19.2.0-native-fb-665de2ed-20250909",
rendererPackageName: "react-dom",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.2.0-native-fb-eda778b8-20250909"
reconcilerVersion: "19.2.0-native-fb-665de2ed-20250909"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_2631 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -17527,4 +17527,4 @@ exports.hydrateRoot = function (container, initialChildren, options) {
listenToAllSupportedEvents(container);
return new ReactDOMHydrationRoot(initialChildren);
};
exports.version = "19.2.0-native-fb-eda778b8-20250909";
exports.version = "19.2.0-native-fb-665de2ed-20250909";
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<c64bab08f49105131cbe217e61b2df74>>
* @generated SignedSource<<06ded55c7bf6ff384642a96c765ea32f>>
*/
/*
@@ -19398,14 +19398,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) {
};
var isomorphicReactPackageVersion$jscomp$inline_2308 = React.version;
if (
"19.2.0-native-fb-eda778b8-20250909" !==
"19.2.0-native-fb-665de2ed-20250909" !==
isomorphicReactPackageVersion$jscomp$inline_2308
)
throw Error(
formatProdErrorMessage(
527,
isomorphicReactPackageVersion$jscomp$inline_2308,
"19.2.0-native-fb-eda778b8-20250909"
"19.2.0-native-fb-665de2ed-20250909"
)
);
ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
@@ -19427,10 +19427,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
};
var internals$jscomp$inline_2315 = {
bundleType: 0,
version: "19.2.0-native-fb-eda778b8-20250909",
version: "19.2.0-native-fb-665de2ed-20250909",
rendererPackageName: "react-dom",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.2.0-native-fb-eda778b8-20250909",
reconcilerVersion: "19.2.0-native-fb-665de2ed-20250909",
getLaneLabelMap: function () {
for (
var map = new Map(), lane = 1, index$324 = 0;
@@ -19553,4 +19553,4 @@ exports.hydrateRoot = function (container, initialChildren, options) {
listenToAllSupportedEvents(container);
return new ReactDOMHydrationRoot(initialChildren);
};
exports.version = "19.2.0-native-fb-eda778b8-20250909";
exports.version = "19.2.0-native-fb-665de2ed-20250909";
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<b972920b9f6b7f866745a564fe2b5314>>
* @generated SignedSource<<45ee4505ee1b5773958a9b13551faa02>>
*/
/*
@@ -29636,11 +29636,11 @@ __DEV__ &&
};
(function () {
var isomorphicReactPackageVersion = React.version;
if ("19.2.0-native-fb-eda778b8-20250909" !== isomorphicReactPackageVersion)
if ("19.2.0-native-fb-665de2ed-20250909" !== isomorphicReactPackageVersion)
throw Error(
'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' +
(isomorphicReactPackageVersion +
"\n - react-dom: 19.2.0-native-fb-eda778b8-20250909\nLearn more: https://react.dev/warnings/version-mismatch")
"\n - react-dom: 19.2.0-native-fb-665de2ed-20250909\nLearn more: https://react.dev/warnings/version-mismatch")
);
})();
("function" === typeof Map &&
@@ -29677,10 +29677,10 @@ __DEV__ &&
!(function () {
var internals = {
bundleType: 1,
version: "19.2.0-native-fb-eda778b8-20250909",
version: "19.2.0-native-fb-665de2ed-20250909",
rendererPackageName: "react-dom",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.2.0-native-fb-eda778b8-20250909"
reconcilerVersion: "19.2.0-native-fb-665de2ed-20250909"
};
internals.overrideHookState = overrideHookState;
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
@@ -30145,7 +30145,7 @@ __DEV__ &&
exports.useFormStatus = function () {
return resolveDispatcher().useHostTransitionStatus();
};
exports.version = "19.2.0-native-fb-eda778b8-20250909";
exports.version = "19.2.0-native-fb-665de2ed-20250909";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<af9875ed91f9c78e61cb7c7928f0a4e5>>
* @generated SignedSource<<2d6207a0e2841f0d8ecf263361edcdb4>>
*/
/*
@@ -17399,14 +17399,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) {
};
var isomorphicReactPackageVersion$jscomp$inline_2058 = React.version;
if (
"19.2.0-native-fb-eda778b8-20250909" !==
"19.2.0-native-fb-665de2ed-20250909" !==
isomorphicReactPackageVersion$jscomp$inline_2058
)
throw Error(
formatProdErrorMessage(
527,
isomorphicReactPackageVersion$jscomp$inline_2058,
"19.2.0-native-fb-eda778b8-20250909"
"19.2.0-native-fb-665de2ed-20250909"
)
);
ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
@@ -17428,10 +17428,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
};
var internals$jscomp$inline_2633 = {
bundleType: 0,
version: "19.2.0-native-fb-eda778b8-20250909",
version: "19.2.0-native-fb-665de2ed-20250909",
rendererPackageName: "react-dom",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.2.0-native-fb-eda778b8-20250909"
reconcilerVersion: "19.2.0-native-fb-665de2ed-20250909"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_2634 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -17691,4 +17691,4 @@ exports.useFormState = function (action, initialState, permalink) {
exports.useFormStatus = function () {
return ReactSharedInternals.H.useHostTransitionStatus();
};
exports.version = "19.2.0-native-fb-eda778b8-20250909";
exports.version = "19.2.0-native-fb-665de2ed-20250909";
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<dbfc9c425479d51586a3ddb0d5e80712>>
* @generated SignedSource<<1112946c2dda066c6cbcc5b9b953b1ba>>
*/
/*
@@ -19413,14 +19413,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) {
};
var isomorphicReactPackageVersion$jscomp$inline_2309 = React.version;
if (
"19.2.0-native-fb-eda778b8-20250909" !==
"19.2.0-native-fb-665de2ed-20250909" !==
isomorphicReactPackageVersion$jscomp$inline_2309
)
throw Error(
formatProdErrorMessage(
527,
isomorphicReactPackageVersion$jscomp$inline_2309,
"19.2.0-native-fb-eda778b8-20250909"
"19.2.0-native-fb-665de2ed-20250909"
)
);
ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
@@ -19442,10 +19442,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
};
var internals$jscomp$inline_2316 = {
bundleType: 0,
version: "19.2.0-native-fb-eda778b8-20250909",
version: "19.2.0-native-fb-665de2ed-20250909",
rendererPackageName: "react-dom",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.2.0-native-fb-eda778b8-20250909",
reconcilerVersion: "19.2.0-native-fb-665de2ed-20250909",
getLaneLabelMap: function () {
for (
var map = new Map(), lane = 1, index$324 = 0;
@@ -19721,7 +19721,7 @@ exports.useFormState = function (action, initialState, permalink) {
exports.useFormStatus = function () {
return ReactSharedInternals.H.useHostTransitionStatus();
};
exports.version = "19.2.0-native-fb-eda778b8-20250909";
exports.version = "19.2.0-native-fb-665de2ed-20250909";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<a717b1aad84235acdb0a4254cc2bd6e4>>
* @generated SignedSource<<b2109dbfe8a4be786224a1f431d2ba84>>
*/
"use strict";
@@ -15881,10 +15881,10 @@ __DEV__ &&
(function () {
var internals = {
bundleType: 1,
version: "19.2.0-native-fb-eda778b8-20250909",
version: "19.2.0-native-fb-665de2ed-20250909",
rendererPackageName: "react-test-renderer",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.2.0-native-fb-eda778b8-20250909"
reconcilerVersion: "19.2.0-native-fb-665de2ed-20250909"
};
internals.overrideHookState = overrideHookState;
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
@@ -16029,5 +16029,5 @@ __DEV__ &&
flushSyncWorkAcrossRoots_impl(0, !0));
}
};
exports.version = "19.2.0-native-fb-eda778b8-20250909";
exports.version = "19.2.0-native-fb-665de2ed-20250909";
})();
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<9b046a330bffb18311e3f407181bda59>>
* @generated SignedSource<<14668f2a88027c74e036af72f81cec51>>
*/
"use strict";
@@ -10045,10 +10045,10 @@ function wrapFiber(fiber) {
}
var internals$jscomp$inline_1469 = {
bundleType: 0,
version: "19.2.0-native-fb-eda778b8-20250909",
version: "19.2.0-native-fb-665de2ed-20250909",
rendererPackageName: "react-test-renderer",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.2.0-native-fb-eda778b8-20250909"
reconcilerVersion: "19.2.0-native-fb-665de2ed-20250909"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1470 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -10184,4 +10184,4 @@ exports.unstable_batchedUpdates = function (fn, a) {
flushSyncWorkAcrossRoots_impl(0, !0));
}
};
exports.version = "19.2.0-native-fb-eda778b8-20250909";
exports.version = "19.2.0-native-fb-665de2ed-20250909";
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<737be23caa297936837cf0aacdc9f27e>>
* @generated SignedSource<<dff03746eb9bcb7ab9bb04928fce704d>>
*/
"use strict";
@@ -10666,10 +10666,10 @@ function wrapFiber(fiber) {
}
var internals$jscomp$inline_1260 = {
bundleType: 0,
version: "19.2.0-native-fb-eda778b8-20250909",
version: "19.2.0-native-fb-665de2ed-20250909",
rendererPackageName: "react-test-renderer",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.2.0-native-fb-eda778b8-20250909",
reconcilerVersion: "19.2.0-native-fb-665de2ed-20250909",
getLaneLabelMap: function () {
for (
var map = new Map(), lane = 1, index$145 = 0;
@@ -10820,4 +10820,4 @@ exports.unstable_batchedUpdates = function (fn, a) {
flushSyncWorkAcrossRoots_impl(0, !0));
}
};
exports.version = "19.2.0-native-fb-eda778b8-20250909";
exports.version = "19.2.0-native-fb-665de2ed-20250909";
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<99bc04bc8603f51115b5ccb8ca2369a8>>
* @generated SignedSource<<937d95fd9642a70729b4fe29e8e4e5ba>>
*/
"use strict";
@@ -1397,7 +1397,7 @@ __DEV__ &&
exports.useTransition = function () {
return resolveDispatcher().useTransition();
};
exports.version = "19.2.0-native-fb-eda778b8-20250909";
exports.version = "19.2.0-native-fb-665de2ed-20250909";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<a4bb1e054a68501548e3f6d1cd692a65>>
* @generated SignedSource<<30acab9cc3593087f175e0f8bf7657f1>>
*/
"use strict";
@@ -579,4 +579,4 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactSharedInternals.H.useTransition();
};
exports.version = "19.2.0-native-fb-eda778b8-20250909";
exports.version = "19.2.0-native-fb-665de2ed-20250909";
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<a3a671a6a898fdd6efb4db4204af1fb1>>
* @generated SignedSource<<bda2e7de0c61150d6d87d4ebf3844334>>
*/
"use strict";
@@ -583,7 +583,7 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactSharedInternals.H.useTransition();
};
exports.version = "19.2.0-native-fb-eda778b8-20250909";
exports.version = "19.2.0-native-fb-665de2ed-20250909";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
@@ -1 +1 @@
eda778b8ae1698fec5fc84ca2530727df8b557b5
665de2ed283205fccecda649ae2d66f62983f15f
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<330eda6a0b3ea0bc958740f3a9df6bfc>>
* @generated SignedSource<<f9c2529fedcfde3a922f9e9efb7f904f>>
*/
"use strict";
@@ -19705,10 +19705,10 @@ __DEV__ &&
(function () {
var internals = {
bundleType: 1,
version: "19.2.0-native-fb-eda778b8-20250909",
version: "19.2.0-native-fb-665de2ed-20250909",
rendererPackageName: "react-native-renderer",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.2.0-native-fb-eda778b8-20250909"
reconcilerVersion: "19.2.0-native-fb-665de2ed-20250909"
};
null !== extraDevToolsConfig &&
(internals.rendererConfig = extraDevToolsConfig);
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<d9f289f242cff9448e2606cf6ae20113>>
* @generated SignedSource<<91de8b0793c434edc1ca7d702cb7ba1a>>
*/
"use strict";
@@ -11211,10 +11211,10 @@ batchedUpdatesImpl = function (fn, a) {
var roots = new Map(),
internals$jscomp$inline_1281 = {
bundleType: 0,
version: "19.2.0-native-fb-eda778b8-20250909",
version: "19.2.0-native-fb-665de2ed-20250909",
rendererPackageName: "react-native-renderer",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.2.0-native-fb-eda778b8-20250909"
reconcilerVersion: "19.2.0-native-fb-665de2ed-20250909"
};
null !== extraDevToolsConfig &&
(internals$jscomp$inline_1281.rendererConfig = extraDevToolsConfig);
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<6ec391ecfd55c67e692dc92f60b10609>>
* @generated SignedSource<<e60f7701c70879c71054cad95087a686>>
*/
"use strict";
@@ -13162,10 +13162,10 @@ batchedUpdatesImpl = function (fn, a) {
var roots = new Map(),
internals$jscomp$inline_1525 = {
bundleType: 0,
version: "19.2.0-native-fb-eda778b8-20250909",
version: "19.2.0-native-fb-665de2ed-20250909",
rendererPackageName: "react-native-renderer",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.2.0-native-fb-eda778b8-20250909"
reconcilerVersion: "19.2.0-native-fb-665de2ed-20250909"
};
null !== extraDevToolsConfig &&
(internals$jscomp$inline_1525.rendererConfig = extraDevToolsConfig);
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<ebaca6772105807501506085c25bf127>>
* @generated SignedSource<<3cc83dbec0b55ccaa36d7c1ba1bf27ce>>
*/
"use strict";
@@ -19985,11 +19985,11 @@ __DEV__ &&
shouldSuspendImpl = newShouldSuspendImpl;
};
var isomorphicReactPackageVersion = React.version;
if ("19.2.0-native-fb-eda778b8-20250909" !== isomorphicReactPackageVersion)
if ("19.2.0-native-fb-665de2ed-20250909" !== isomorphicReactPackageVersion)
throw Error(
'Incompatible React versions: The "react" and "react-native-renderer" packages must have the exact same version. Instead got:\n - react: ' +
(isomorphicReactPackageVersion +
"\n - react-native-renderer: 19.2.0-native-fb-eda778b8-20250909\nLearn more: https://react.dev/warnings/version-mismatch")
"\n - react-native-renderer: 19.2.0-native-fb-665de2ed-20250909\nLearn more: https://react.dev/warnings/version-mismatch")
);
if (
"function" !==
@@ -20015,10 +20015,10 @@ __DEV__ &&
(function () {
var internals = {
bundleType: 1,
version: "19.2.0-native-fb-eda778b8-20250909",
version: "19.2.0-native-fb-665de2ed-20250909",
rendererPackageName: "react-native-renderer",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.2.0-native-fb-eda778b8-20250909"
reconcilerVersion: "19.2.0-native-fb-665de2ed-20250909"
};
null !== extraDevToolsConfig &&
(internals.rendererConfig = extraDevToolsConfig);
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<d60b5d94aafb9791a1cc35de1067b692>>
* @generated SignedSource<<4fb30a55685d773037015b4f3faf3665>>
*/
"use strict";
@@ -11370,11 +11370,11 @@ function updateContainer(element, container, parentComponent, callback) {
return lane;
}
var isomorphicReactPackageVersion = React.version;
if ("19.2.0-native-fb-eda778b8-20250909" !== isomorphicReactPackageVersion)
if ("19.2.0-native-fb-665de2ed-20250909" !== isomorphicReactPackageVersion)
throw Error(
'Incompatible React versions: The "react" and "react-native-renderer" packages must have the exact same version. Instead got:\n - react: ' +
(isomorphicReactPackageVersion +
"\n - react-native-renderer: 19.2.0-native-fb-eda778b8-20250909\nLearn more: https://react.dev/warnings/version-mismatch")
"\n - react-native-renderer: 19.2.0-native-fb-665de2ed-20250909\nLearn more: https://react.dev/warnings/version-mismatch")
);
if (
"function" !==
@@ -11424,10 +11424,10 @@ batchedUpdatesImpl = function (fn, a) {
var roots = new Map(),
internals$jscomp$inline_1312 = {
bundleType: 0,
version: "19.2.0-native-fb-eda778b8-20250909",
version: "19.2.0-native-fb-665de2ed-20250909",
rendererPackageName: "react-native-renderer",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.2.0-native-fb-eda778b8-20250909"
reconcilerVersion: "19.2.0-native-fb-665de2ed-20250909"
};
null !== extraDevToolsConfig &&
(internals$jscomp$inline_1312.rendererConfig = extraDevToolsConfig);
@@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<8258415aeb55102aae5d3d750a926aac>>
* @generated SignedSource<<e4519b88ce07656ec0c1e9ded245b8d2>>
*/
"use strict";
@@ -13311,11 +13311,11 @@ function updateContainer(element, container, parentComponent, callback) {
return lane;
}
var isomorphicReactPackageVersion = React.version;
if ("19.2.0-native-fb-eda778b8-20250909" !== isomorphicReactPackageVersion)
if ("19.2.0-native-fb-665de2ed-20250909" !== isomorphicReactPackageVersion)
throw Error(
'Incompatible React versions: The "react" and "react-native-renderer" packages must have the exact same version. Instead got:\n - react: ' +
(isomorphicReactPackageVersion +
"\n - react-native-renderer: 19.2.0-native-fb-eda778b8-20250909\nLearn more: https://react.dev/warnings/version-mismatch")
"\n - react-native-renderer: 19.2.0-native-fb-665de2ed-20250909\nLearn more: https://react.dev/warnings/version-mismatch")
);
if (
"function" !==
@@ -13365,10 +13365,10 @@ batchedUpdatesImpl = function (fn, a) {
var roots = new Map(),
internals$jscomp$inline_1556 = {
bundleType: 0,
version: "19.2.0-native-fb-eda778b8-20250909",
version: "19.2.0-native-fb-665de2ed-20250909",
rendererPackageName: "react-native-renderer",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.2.0-native-fb-eda778b8-20250909"
reconcilerVersion: "19.2.0-native-fb-665de2ed-20250909"
};
null !== extraDevToolsConfig &&
(internals$jscomp$inline_1556.rendererConfig = extraDevToolsConfig);
@@ -12,7 +12,7 @@
* @lightSyntaxTransform
* @preventMunge
* @oncall react_core
* @generated SignedSource<<bb70fb86f6bdd2a20d4ce404371949d1>>
* @generated SignedSource<<86801b386ac250b9135b01fcdf6eceba>>
*/
'use strict';
@@ -18616,38 +18616,40 @@ function forkTemporaryIdentifier(id, source) {
return Object.assign(Object.assign({}, source), { mutableRange: { start: makeInstructionId(0), end: makeInstructionId(0) }, id });
}
function validateIdentifierName(name) {
if (isReservedWord(name) || !libExports$1.isValidIdentifier(name)) {
return Err(null);
}
return Ok(makeIdentifierName(name).value);
}
function makeIdentifierName(name) {
if (isReservedWord(name)) {
CompilerError.throwInvalidJS({
const error = new CompilerError();
error.pushDiagnostic(CompilerDiagnostic.create({
category: ErrorCategory.Syntax,
reason: 'Expected a non-reserved identifier name',
loc: GeneratedSource,
description: `\`${name}\` is a reserved word in JavaScript and cannot be used as an identifier name`,
suggestions: null,
});
}).withDetails({
kind: 'error',
loc: GeneratedSource,
message: 'reserved word',
}));
return Err(error);
}
else {
CompilerError.invariant(libExports$1.isValidIdentifier(name), {
else if (!libExports$1.isValidIdentifier(name)) {
const error = new CompilerError();
error.pushDiagnostic(CompilerDiagnostic.create({
category: ErrorCategory.Syntax,
reason: `Expected a valid identifier name`,
description: `\`${name}\` is not a valid JavaScript identifier`,
details: [
{
kind: 'error',
loc: GeneratedSource,
message: null,
},
],
suggestions: null,
});
}).withDetails({
kind: 'error',
loc: GeneratedSource,
message: 'reserved word',
}));
}
return {
return Ok({
kind: 'named',
value: name,
};
});
}
function makeIdentifierName(name) {
return validateIdentifierName(name).unwrap();
}
function promoteTemporary(identifier) {
CompilerError.invariant(identifier.name === null, {
@@ -19032,6 +19034,9 @@ function printFunction(fn) {
else {
definition += '<<anonymous>>';
}
if (fn.nameHint != null) {
definition += ` ${fn.nameHint}`;
}
if (fn.params.length !== 0) {
definition +=
'(' +
@@ -23034,6 +23039,16 @@ function lower(func, env, bindings = null, capturedRefs = new Map()) {
message: 'Expected a block statement or expression',
}));
}
let validatedId = null;
if (id != null) {
const idResult = validateIdentifierName(id);
if (idResult.isErr()) {
builder.errors.merge(idResult.unwrapErr());
}
else {
validatedId = idResult.unwrap().value;
}
}
if (builder.errors.hasAnyErrors()) {
return Err(builder.errors);
}
@@ -23050,7 +23065,8 @@ function lower(func, env, bindings = null, capturedRefs = new Map()) {
effects: null,
}, null);
return Ok({
id,
id: validatedId,
nameHint: null,
params,
fnType: bindings == null ? env.fnType : 'Other',
returnTypeAnnotation: null,
@@ -25849,23 +25865,17 @@ function trimJsxText(original) {
}
}
function lowerFunctionToValue(builder, expr) {
var _a, _b, _c, _d, _e, _f, _g;
var _a;
const exprNode = expr.node;
const exprLoc = (_a = exprNode.loc) !== null && _a !== void 0 ? _a : GeneratedSource;
let name = null;
if (expr.isFunctionExpression()) {
name = (_d = (_c = (_b = expr.get('id')) === null || _b === void 0 ? void 0 : _b.node) === null || _c === void 0 ? void 0 : _c.name) !== null && _d !== void 0 ? _d : null;
}
else if (expr.isFunctionDeclaration()) {
name = (_g = (_f = (_e = expr.get('id')) === null || _e === void 0 ? void 0 : _e.node) === null || _f === void 0 ? void 0 : _f.name) !== null && _g !== void 0 ? _g : null;
}
const loweredFunc = lowerFunction(builder, expr);
if (!loweredFunc) {
return { kind: 'UnsupportedNode', node: exprNode, loc: exprLoc };
}
return {
kind: 'FunctionExpression',
name,
name: loweredFunc.func.id,
nameHint: null,
type: expr.node.type,
loc: exprLoc,
loweredFunc,
@@ -35803,6 +35813,7 @@ function buildReactiveFunction(fn) {
return {
loc: fn.loc,
id: fn.id,
nameHint: fn.nameHint,
params: fn.params,
generator: fn.generator,
async: fn.async,
@@ -37399,6 +37410,7 @@ function codegenReactiveFunction(cx, fn) {
type: 'CodegenFunction',
loc: fn.loc,
id: fn.id !== null ? libExports$1.identifier(fn.id) : null,
nameHint: fn.nameHint,
params,
body,
generator: fn.generator,
@@ -38786,9 +38798,6 @@ function codegenInstructionValue(cx, instrValue) {
pruneUnusedLValues(reactiveFunction);
pruneHoistedContexts(reactiveFunction);
const fn = codegenReactiveFunction(new Context$2(cx.env, (_g = reactiveFunction.id) !== null && _g !== void 0 ? _g : '[[ anonymous ]]', cx.uniqueIdentifiers, cx.fbtOperands, cx.temp), reactiveFunction).unwrap();
const validatedName = instrValue.name != null
? validateIdentifierName(instrValue.name)
: Err(null);
if (instrValue.type === 'ArrowFunctionExpression') {
let body = fn.body;
if (body.body.length === 1 && loweredFunc.directives.length == 0) {
@@ -38800,14 +38809,12 @@ function codegenInstructionValue(cx, instrValue) {
value = libExports$1.arrowFunctionExpression(fn.params, body, fn.async);
}
else {
value = libExports$1.functionExpression(validatedName
.map(name => libExports$1.identifier(name))
.unwrapOr(null), fn.params, fn.body, fn.generator, fn.async);
value = libExports$1.functionExpression(instrValue.name != null ? libExports$1.identifier(instrValue.name) : null, fn.params, fn.body, fn.generator, fn.async);
}
if (cx.env.config.enableNameAnonymousFunctions &&
validatedName.isErr() &&
instrValue.name != null) {
const name = instrValue.name;
instrValue.name == null &&
instrValue.nameHint != null) {
const name = instrValue.nameHint;
value = libExports$1.memberExpression(libExports$1.objectExpression([libExports$1.objectProperty(libExports$1.stringLiteral(name), value)]), libExports$1.stringLiteral(name), true, false);
}
break;
@@ -50302,6 +50309,7 @@ function getContextReassignment(fn, contextVariables, isFunctionExpression, isAs
}
function outlineFunctions(fn, fbtOperands) {
var _a;
for (const [, block] of fn.body.blocks) {
for (const instr of block.instructions) {
const { value, lvalue } = instr;
@@ -50314,7 +50322,7 @@ function outlineFunctions(fn, fbtOperands) {
value.loweredFunc.func.id === null &&
!fbtOperands.has(lvalue.identifier.id)) {
const loweredFunc = value.loweredFunc.func;
const id = fn.env.generateGloballyUniqueIdentifierName(loweredFunc.id);
const id = fn.env.generateGloballyUniqueIdentifierName((_a = loweredFunc.id) !== null && _a !== void 0 ? _a : loweredFunc.nameHint);
loweredFunc.id = id.value;
fn.env.outlineFunction(loweredFunc, null);
instr.value = {
@@ -50495,6 +50503,7 @@ function emitSelectorFn(env, keys) {
const fn = {
loc: GeneratedSource,
id: null,
nameHint: null,
fnType: 'Other',
env,
params: [obj],
@@ -50519,6 +50528,7 @@ function emitSelectorFn(env, keys) {
value: {
kind: 'FunctionExpression',
name: null,
nameHint: null,
loweredFunc: {
func: fn,
},
@@ -50927,6 +50937,7 @@ function emitOutlinedFn(env, jsx, oldProps, globals) {
const fn = {
loc: GeneratedSource,
id: null,
nameHint: null,
fnType: 'Other',
env,
params: [propsObj],
@@ -51870,7 +51881,8 @@ function nameAnonymousFunctions(fn) {
var _a, _b;
if (node.generatedName != null) {
const name = `${prefix}${node.generatedName}]`;
node.fn.name = name;
node.fn.nameHint = name;
node.fn.loweredFunc.func.nameHint = name;
}
const nextPrefix = `${prefix}${(_b = (_a = node.generatedName) !== null && _a !== void 0 ? _a : node.fn.name) !== null && _b !== void 0 ? _b : '<anonymous>'} > `;
for (const inner of node.inner) {
@@ -52130,6 +52142,14 @@ function runWithEnvironment(func, env) {
if (env.config.enableJsxOutlining) {
outlineJSX(hir);
}
if (env.config.enableNameAnonymousFunctions) {
nameAnonymousFunctions(hir);
log({
kind: 'hir',
name: 'NameAnonymousFunctions',
value: hir,
});
}
if (env.config.enableFunctionOutlining) {
outlineFunctions(hir, fbtOperands);
log({ kind: 'hir', name: 'OutlineFunctions', value: hir });
@@ -52208,14 +52228,6 @@ function runWithEnvironment(func, env) {
value: hir,
});
}
if (env.config.enableNameAnonymousFunctions) {
nameAnonymousFunctions(hir);
log({
kind: 'hir',
name: 'NameAnonymougFunctions',
value: hir,
});
}
const reactiveFunction = buildReactiveFunction(hir);
log({
kind: 'reactive',
@@ -6,7 +6,7 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
* @generated SignedSource<<db8f1c3f9450695503dc49c957b96d6c>>
* @generated SignedSource<<f6737d36b6bb79d1b99ebe7f70fb14b8>>
*/
'use strict';
@@ -18601,38 +18601,40 @@ function forkTemporaryIdentifier(id, source) {
return Object.assign(Object.assign({}, source), { mutableRange: { start: makeInstructionId(0), end: makeInstructionId(0) }, id });
}
function validateIdentifierName(name) {
if (isReservedWord(name) || !libExports$1.isValidIdentifier(name)) {
return Err(null);
}
return Ok(makeIdentifierName(name).value);
}
function makeIdentifierName(name) {
if (isReservedWord(name)) {
CompilerError.throwInvalidJS({
const error = new CompilerError();
error.pushDiagnostic(CompilerDiagnostic.create({
category: ErrorCategory.Syntax,
reason: 'Expected a non-reserved identifier name',
loc: GeneratedSource,
description: `\`${name}\` is a reserved word in JavaScript and cannot be used as an identifier name`,
suggestions: null,
});
}).withDetails({
kind: 'error',
loc: GeneratedSource,
message: 'reserved word',
}));
return Err(error);
}
else {
CompilerError.invariant(libExports$1.isValidIdentifier(name), {
else if (!libExports$1.isValidIdentifier(name)) {
const error = new CompilerError();
error.pushDiagnostic(CompilerDiagnostic.create({
category: ErrorCategory.Syntax,
reason: `Expected a valid identifier name`,
description: `\`${name}\` is not a valid JavaScript identifier`,
details: [
{
kind: 'error',
loc: GeneratedSource,
message: null,
},
],
suggestions: null,
});
}).withDetails({
kind: 'error',
loc: GeneratedSource,
message: 'reserved word',
}));
}
return {
return Ok({
kind: 'named',
value: name,
};
});
}
function makeIdentifierName(name) {
return validateIdentifierName(name).unwrap();
}
function promoteTemporary(identifier) {
CompilerError.invariant(identifier.name === null, {
@@ -19017,6 +19019,9 @@ function printFunction(fn) {
else {
definition += '<<anonymous>>';
}
if (fn.nameHint != null) {
definition += ` ${fn.nameHint}`;
}
if (fn.params.length !== 0) {
definition +=
'(' +
@@ -23019,6 +23024,16 @@ function lower(func, env, bindings = null, capturedRefs = new Map()) {
message: 'Expected a block statement or expression',
}));
}
let validatedId = null;
if (id != null) {
const idResult = validateIdentifierName(id);
if (idResult.isErr()) {
builder.errors.merge(idResult.unwrapErr());
}
else {
validatedId = idResult.unwrap().value;
}
}
if (builder.errors.hasAnyErrors()) {
return Err(builder.errors);
}
@@ -23035,7 +23050,8 @@ function lower(func, env, bindings = null, capturedRefs = new Map()) {
effects: null,
}, null);
return Ok({
id,
id: validatedId,
nameHint: null,
params,
fnType: bindings == null ? env.fnType : 'Other',
returnTypeAnnotation: null,
@@ -25834,23 +25850,17 @@ function trimJsxText(original) {
}
}
function lowerFunctionToValue(builder, expr) {
var _a, _b, _c, _d, _e, _f, _g;
var _a;
const exprNode = expr.node;
const exprLoc = (_a = exprNode.loc) !== null && _a !== void 0 ? _a : GeneratedSource;
let name = null;
if (expr.isFunctionExpression()) {
name = (_d = (_c = (_b = expr.get('id')) === null || _b === void 0 ? void 0 : _b.node) === null || _c === void 0 ? void 0 : _c.name) !== null && _d !== void 0 ? _d : null;
}
else if (expr.isFunctionDeclaration()) {
name = (_g = (_f = (_e = expr.get('id')) === null || _e === void 0 ? void 0 : _e.node) === null || _f === void 0 ? void 0 : _f.name) !== null && _g !== void 0 ? _g : null;
}
const loweredFunc = lowerFunction(builder, expr);
if (!loweredFunc) {
return { kind: 'UnsupportedNode', node: exprNode, loc: exprLoc };
}
return {
kind: 'FunctionExpression',
name,
name: loweredFunc.func.id,
nameHint: null,
type: expr.node.type,
loc: exprLoc,
loweredFunc,
@@ -35582,6 +35592,7 @@ function buildReactiveFunction(fn) {
return {
loc: fn.loc,
id: fn.id,
nameHint: fn.nameHint,
params: fn.params,
generator: fn.generator,
async: fn.async,
@@ -37178,6 +37189,7 @@ function codegenReactiveFunction(cx, fn) {
type: 'CodegenFunction',
loc: fn.loc,
id: fn.id !== null ? libExports$1.identifier(fn.id) : null,
nameHint: fn.nameHint,
params,
body,
generator: fn.generator,
@@ -38565,9 +38577,6 @@ function codegenInstructionValue(cx, instrValue) {
pruneUnusedLValues(reactiveFunction);
pruneHoistedContexts(reactiveFunction);
const fn = codegenReactiveFunction(new Context$2(cx.env, (_g = reactiveFunction.id) !== null && _g !== void 0 ? _g : '[[ anonymous ]]', cx.uniqueIdentifiers, cx.fbtOperands, cx.temp), reactiveFunction).unwrap();
const validatedName = instrValue.name != null
? validateIdentifierName(instrValue.name)
: Err(null);
if (instrValue.type === 'ArrowFunctionExpression') {
let body = fn.body;
if (body.body.length === 1 && loweredFunc.directives.length == 0) {
@@ -38579,14 +38588,12 @@ function codegenInstructionValue(cx, instrValue) {
value = libExports$1.arrowFunctionExpression(fn.params, body, fn.async);
}
else {
value = libExports$1.functionExpression(validatedName
.map(name => libExports$1.identifier(name))
.unwrapOr(null), fn.params, fn.body, fn.generator, fn.async);
value = libExports$1.functionExpression(instrValue.name != null ? libExports$1.identifier(instrValue.name) : null, fn.params, fn.body, fn.generator, fn.async);
}
if (cx.env.config.enableNameAnonymousFunctions &&
validatedName.isErr() &&
instrValue.name != null) {
const name = instrValue.name;
instrValue.name == null &&
instrValue.nameHint != null) {
const name = instrValue.nameHint;
value = libExports$1.memberExpression(libExports$1.objectExpression([libExports$1.objectProperty(libExports$1.stringLiteral(name), value)]), libExports$1.stringLiteral(name), true, false);
}
break;
@@ -50081,6 +50088,7 @@ function getContextReassignment(fn, contextVariables, isFunctionExpression, isAs
}
function outlineFunctions(fn, fbtOperands) {
var _a;
for (const [, block] of fn.body.blocks) {
for (const instr of block.instructions) {
const { value, lvalue } = instr;
@@ -50093,7 +50101,7 @@ function outlineFunctions(fn, fbtOperands) {
value.loweredFunc.func.id === null &&
!fbtOperands.has(lvalue.identifier.id)) {
const loweredFunc = value.loweredFunc.func;
const id = fn.env.generateGloballyUniqueIdentifierName(loweredFunc.id);
const id = fn.env.generateGloballyUniqueIdentifierName((_a = loweredFunc.id) !== null && _a !== void 0 ? _a : loweredFunc.nameHint);
loweredFunc.id = id.value;
fn.env.outlineFunction(loweredFunc, null);
instr.value = {
@@ -50274,6 +50282,7 @@ function emitSelectorFn(env, keys) {
const fn = {
loc: GeneratedSource,
id: null,
nameHint: null,
fnType: 'Other',
env,
params: [obj],
@@ -50298,6 +50307,7 @@ function emitSelectorFn(env, keys) {
value: {
kind: 'FunctionExpression',
name: null,
nameHint: null,
loweredFunc: {
func: fn,
},
@@ -50706,6 +50716,7 @@ function emitOutlinedFn(env, jsx, oldProps, globals) {
const fn = {
loc: GeneratedSource,
id: null,
nameHint: null,
fnType: 'Other',
env,
params: [propsObj],
@@ -51649,7 +51660,8 @@ function nameAnonymousFunctions(fn) {
var _a, _b;
if (node.generatedName != null) {
const name = `${prefix}${node.generatedName}]`;
node.fn.name = name;
node.fn.nameHint = name;
node.fn.loweredFunc.func.nameHint = name;
}
const nextPrefix = `${prefix}${(_b = (_a = node.generatedName) !== null && _a !== void 0 ? _a : node.fn.name) !== null && _b !== void 0 ? _b : '<anonymous>'} > `;
for (const inner of node.inner) {
@@ -51909,6 +51921,14 @@ function runWithEnvironment(func, env) {
if (env.config.enableJsxOutlining) {
outlineJSX(hir);
}
if (env.config.enableNameAnonymousFunctions) {
nameAnonymousFunctions(hir);
log({
kind: 'hir',
name: 'NameAnonymousFunctions',
value: hir,
});
}
if (env.config.enableFunctionOutlining) {
outlineFunctions(hir, fbtOperands);
log({ kind: 'hir', name: 'OutlineFunctions', value: hir });
@@ -51987,14 +52007,6 @@ function runWithEnvironment(func, env) {
value: hir,
});
}
if (env.config.enableNameAnonymousFunctions) {
nameAnonymousFunctions(hir);
log({
kind: 'hir',
name: 'NameAnonymougFunctions',
value: hir,
});
}
const reactiveFunction = buildReactiveFunction(hir);
log({
kind: 'reactive',
@@ -1,7 +1,7 @@
{
"name": "eslint-plugin-react-hooks",
"description": "ESLint rules for React Hooks",
"version": "0.0.0-experimental-eda778b8-20250909",
"version": "0.0.0-experimental-665de2ed-20250909",
"repository": {
"type": "git",
"url": "https://github.com/facebook/react.git",