Skip to content

Commit 59b07a2

Browse files
committed
[compiler] Consolidate HIRFunction return information (#33640)
We now have `HIRFunction.returns: Place` as well as `returnType: Type`. I want to add additional return information, so as a first step i'm consolidating everything under an object at `HIRFunction.returns: {place: Place}`. We use the type of this place as the return type. Next step is to add more properties to this object to represent things like the return kind. --- [//]: # (BEGIN SAPLING FOOTER) Stack created with [Sapling](https://sapling-scm.com). Best reviewed with [ReviewStack](https://reviewstack.dev/facebook/react/pull/33640). * #33643 * #33642 * __->__ #33640 * #33625 * #33624 DiffTrain build for [123ff13](123ff13)
1 parent ab9cbb6 commit 59b07a2

35 files changed

+99
-99
lines changed

compiled/eslint-plugin-react-hooks/index.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27076,6 +27076,9 @@ function printFunction(fn) {
2707627076
if (fn.id !== null) {
2707727077
definition += fn.id;
2707827078
}
27079+
else {
27080+
definition += '<<anonymous>>';
27081+
}
2707927082
if (fn.params.length !== 0) {
2708027083
definition +=
2708127084
'(' +
@@ -27094,10 +27097,8 @@ function printFunction(fn) {
2709427097
else {
2709527098
definition += '()';
2709627099
}
27097-
if (definition.length !== 0) {
27098-
output.push(definition);
27099-
}
27100-
output.push(`: ${printType(fn.returnType)} @ ${printPlace(fn.returns)}`);
27100+
definition += `: ${printPlace(fn.returns)}`;
27101+
output.push(definition);
2710127102
output.push(...fn.directives);
2710227103
output.push(printHIR(fn.body));
2710327104
return output.join('\n');
@@ -30922,7 +30923,6 @@ function lower$1(func, env, bindings = null, capturedRefs = new Map()) {
3092230923
params,
3092330924
fnType: bindings == null ? env.fnType : 'Other',
3092430925
returnTypeAnnotation: null,
30925-
returnType: makeType(),
3092630926
returns: createTemporaryPlace(env, (_b = func.node.loc) !== null && _b !== void 0 ? _b : GeneratedSource),
3092730927
body: builder.build(),
3092830928
context,
@@ -51683,12 +51683,13 @@ function inferMutationAliasingRanges(fn, { isFunctionExpression }) {
5168351683
}
5168451684
}
5168551685
}
51686+
const returns = fn.returns.identifier;
5168651687
functionEffects.push({
5168751688
kind: 'Create',
5168851689
into: fn.returns,
51689-
value: fn.returnType.kind === 'Primitive'
51690+
value: isPrimitiveType(returns)
5169051691
? ValueKind.Primitive
51691-
: isJsxType(fn.returnType)
51692+
: isJsxType(returns.type)
5169251693
? ValueKind.Frozen
5169351694
: ValueKind.Mutable,
5169451695
reason: ValueReason.KnownReturnSignature,
@@ -55272,7 +55273,8 @@ function apply(func, unifier) {
5527255273
}
5527355274
}
5527455275
}
55275-
func.returnType = unifier.get(func.returnType);
55276+
const returns = func.returns.identifier;
55277+
returns.type = unifier.get(returns.type);
5527655278
}
5527755279
function equation(left, right) {
5527855280
return {
@@ -55314,13 +55316,13 @@ function* generate(func) {
5531455316
}
5531555317
}
5531655318
if (returnTypes.length > 1) {
55317-
yield equation(func.returnType, {
55319+
yield equation(func.returns.identifier.type, {
5531855320
kind: 'Phi',
5531955321
operands: returnTypes,
5532055322
});
5532155323
}
5532255324
else if (returnTypes.length === 1) {
55323-
yield equation(func.returnType, returnTypes[0]);
55325+
yield equation(func.returns.identifier.type, returnTypes[0]);
5532455326
}
5532555327
}
5532655328
function setName(names, id, name) {
@@ -55531,7 +55533,7 @@ function* generateInstructionTypes(env, names, instr) {
5553155533
yield equation(left, {
5553255534
kind: 'Function',
5553355535
shapeId: BuiltInFunctionId,
55534-
return: value.loweredFunc.func.returnType,
55536+
return: value.loweredFunc.func.returns.identifier.type,
5553555537
isConstructor: false,
5553655538
});
5553755539
break;
@@ -57674,7 +57676,6 @@ function emitSelectorFn(env, keys) {
5767457676
env,
5767557677
params: [obj],
5767657678
returnTypeAnnotation: null,
57677-
returnType: makeType(),
5767857679
returns: createTemporaryPlace(env, GeneratedSource),
5767957680
context: [],
5768057681
effects: null,
@@ -58092,7 +58093,6 @@ function emitOutlinedFn(env, jsx, oldProps, globals) {
5809258093
env,
5809358094
params: [propsObj],
5809458095
returnTypeAnnotation: null,
58095-
returnType: makeType(),
5809658096
returns: createTemporaryPlace(env, GeneratedSource),
5809758097
context: [],
5809858098
effects: null,

compiled/facebook-www/REVISION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
e130c08b06470b5fc4ec8095310d19e782924427
1+
123ff13b193cd361a61b99056dd08f2decd7f55d
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
e130c08b06470b5fc4ec8095310d19e782924427
1+
123ff13b193cd361a61b99056dd08f2decd7f55d

compiled/facebook-www/React-dev.classic.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1479,7 +1479,7 @@ __DEV__ &&
14791479
exports.useTransition = function () {
14801480
return resolveDispatcher().useTransition();
14811481
};
1482-
exports.version = "19.2.0-www-classic-e130c08b-20250625";
1482+
exports.version = "19.2.0-www-classic-123ff13b-20250625";
14831483
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
14841484
"function" ===
14851485
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

compiled/facebook-www/React-dev.modern.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1479,7 +1479,7 @@ __DEV__ &&
14791479
exports.useTransition = function () {
14801480
return resolveDispatcher().useTransition();
14811481
};
1482-
exports.version = "19.2.0-www-modern-e130c08b-20250625";
1482+
exports.version = "19.2.0-www-modern-123ff13b-20250625";
14831483
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
14841484
"function" ===
14851485
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

compiled/facebook-www/React-prod.classic.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -630,4 +630,4 @@ exports.useSyncExternalStore = function (
630630
exports.useTransition = function () {
631631
return ReactSharedInternals.H.useTransition();
632632
};
633-
exports.version = "19.2.0-www-classic-e130c08b-20250625";
633+
exports.version = "19.2.0-www-classic-123ff13b-20250625";

compiled/facebook-www/React-prod.modern.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -630,4 +630,4 @@ exports.useSyncExternalStore = function (
630630
exports.useTransition = function () {
631631
return ReactSharedInternals.H.useTransition();
632632
};
633-
exports.version = "19.2.0-www-modern-e130c08b-20250625";
633+
exports.version = "19.2.0-www-modern-123ff13b-20250625";

compiled/facebook-www/React-profiling.classic.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ exports.useSyncExternalStore = function (
634634
exports.useTransition = function () {
635635
return ReactSharedInternals.H.useTransition();
636636
};
637-
exports.version = "19.2.0-www-classic-e130c08b-20250625";
637+
exports.version = "19.2.0-www-classic-123ff13b-20250625";
638638
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
639639
"function" ===
640640
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

compiled/facebook-www/React-profiling.modern.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ exports.useSyncExternalStore = function (
634634
exports.useTransition = function () {
635635
return ReactSharedInternals.H.useTransition();
636636
};
637-
exports.version = "19.2.0-www-modern-e130c08b-20250625";
637+
exports.version = "19.2.0-www-modern-123ff13b-20250625";
638638
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
639639
"function" ===
640640
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

compiled/facebook-www/ReactART-dev.classic.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19073,10 +19073,10 @@ __DEV__ &&
1907319073
(function () {
1907419074
var internals = {
1907519075
bundleType: 1,
19076-
version: "19.2.0-www-classic-e130c08b-20250625",
19076+
version: "19.2.0-www-classic-123ff13b-20250625",
1907719077
rendererPackageName: "react-art",
1907819078
currentDispatcherRef: ReactSharedInternals,
19079-
reconcilerVersion: "19.2.0-www-classic-e130c08b-20250625"
19079+
reconcilerVersion: "19.2.0-www-classic-123ff13b-20250625"
1908019080
};
1908119081
internals.overrideHookState = overrideHookState;
1908219082
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
@@ -19110,7 +19110,7 @@ __DEV__ &&
1911019110
exports.Shape = Shape;
1911119111
exports.Surface = Surface;
1911219112
exports.Text = Text;
19113-
exports.version = "19.2.0-www-classic-e130c08b-20250625";
19113+
exports.version = "19.2.0-www-classic-123ff13b-20250625";
1911419114
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
1911519115
"function" ===
1911619116
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

compiled/facebook-www/ReactART-dev.modern.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18845,10 +18845,10 @@ __DEV__ &&
1884518845
(function () {
1884618846
var internals = {
1884718847
bundleType: 1,
18848-
version: "19.2.0-www-modern-e130c08b-20250625",
18848+
version: "19.2.0-www-modern-123ff13b-20250625",
1884918849
rendererPackageName: "react-art",
1885018850
currentDispatcherRef: ReactSharedInternals,
18851-
reconcilerVersion: "19.2.0-www-modern-e130c08b-20250625"
18851+
reconcilerVersion: "19.2.0-www-modern-123ff13b-20250625"
1885218852
};
1885318853
internals.overrideHookState = overrideHookState;
1885418854
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
@@ -18882,7 +18882,7 @@ __DEV__ &&
1888218882
exports.Shape = Shape;
1888318883
exports.Surface = Surface;
1888418884
exports.Text = Text;
18885-
exports.version = "19.2.0-www-modern-e130c08b-20250625";
18885+
exports.version = "19.2.0-www-modern-123ff13b-20250625";
1888618886
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
1888718887
"function" ===
1888818888
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

compiled/facebook-www/ReactART-prod.classic.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11346,10 +11346,10 @@ var slice = Array.prototype.slice,
1134611346
})(React.Component);
1134711347
var internals$jscomp$inline_1629 = {
1134811348
bundleType: 0,
11349-
version: "19.2.0-www-classic-e130c08b-20250625",
11349+
version: "19.2.0-www-classic-123ff13b-20250625",
1135011350
rendererPackageName: "react-art",
1135111351
currentDispatcherRef: ReactSharedInternals,
11352-
reconcilerVersion: "19.2.0-www-classic-e130c08b-20250625"
11352+
reconcilerVersion: "19.2.0-www-classic-123ff13b-20250625"
1135311353
};
1135411354
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
1135511355
var hook$jscomp$inline_1630 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -11375,4 +11375,4 @@ exports.RadialGradient = RadialGradient;
1137511375
exports.Shape = TYPES.SHAPE;
1137611376
exports.Surface = Surface;
1137711377
exports.Text = Text;
11378-
exports.version = "19.2.0-www-classic-e130c08b-20250625";
11378+
exports.version = "19.2.0-www-classic-123ff13b-20250625";

compiled/facebook-www/ReactART-prod.modern.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11062,10 +11062,10 @@ var slice = Array.prototype.slice,
1106211062
})(React.Component);
1106311063
var internals$jscomp$inline_1602 = {
1106411064
bundleType: 0,
11065-
version: "19.2.0-www-modern-e130c08b-20250625",
11065+
version: "19.2.0-www-modern-123ff13b-20250625",
1106611066
rendererPackageName: "react-art",
1106711067
currentDispatcherRef: ReactSharedInternals,
11068-
reconcilerVersion: "19.2.0-www-modern-e130c08b-20250625"
11068+
reconcilerVersion: "19.2.0-www-modern-123ff13b-20250625"
1106911069
};
1107011070
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
1107111071
var hook$jscomp$inline_1603 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -11091,4 +11091,4 @@ exports.RadialGradient = RadialGradient;
1109111091
exports.Shape = TYPES.SHAPE;
1109211092
exports.Surface = Surface;
1109311093
exports.Text = Text;
11094-
exports.version = "19.2.0-www-modern-e130c08b-20250625";
11094+
exports.version = "19.2.0-www-modern-123ff13b-20250625";

compiled/facebook-www/ReactDOM-dev.classic.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31449,11 +31449,11 @@ __DEV__ &&
3144931449
return_targetInst = null;
3145031450
(function () {
3145131451
var isomorphicReactPackageVersion = React.version;
31452-
if ("19.2.0-www-classic-e130c08b-20250625" !== isomorphicReactPackageVersion)
31452+
if ("19.2.0-www-classic-123ff13b-20250625" !== isomorphicReactPackageVersion)
3145331453
throw Error(
3145431454
'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' +
3145531455
(isomorphicReactPackageVersion +
31456-
"\n - react-dom: 19.2.0-www-classic-e130c08b-20250625\nLearn more: https://react.dev/warnings/version-mismatch")
31456+
"\n - react-dom: 19.2.0-www-classic-123ff13b-20250625\nLearn more: https://react.dev/warnings/version-mismatch")
3145731457
);
3145831458
})();
3145931459
("function" === typeof Map &&
@@ -31496,10 +31496,10 @@ __DEV__ &&
3149631496
!(function () {
3149731497
var internals = {
3149831498
bundleType: 1,
31499-
version: "19.2.0-www-classic-e130c08b-20250625",
31499+
version: "19.2.0-www-classic-123ff13b-20250625",
3150031500
rendererPackageName: "react-dom",
3150131501
currentDispatcherRef: ReactSharedInternals,
31502-
reconcilerVersion: "19.2.0-www-classic-e130c08b-20250625"
31502+
reconcilerVersion: "19.2.0-www-classic-123ff13b-20250625"
3150331503
};
3150431504
internals.overrideHookState = overrideHookState;
3150531505
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
@@ -32099,7 +32099,7 @@ __DEV__ &&
3209932099
exports.useFormStatus = function () {
3210032100
return resolveDispatcher().useHostTransitionStatus();
3210132101
};
32102-
exports.version = "19.2.0-www-classic-e130c08b-20250625";
32102+
exports.version = "19.2.0-www-classic-123ff13b-20250625";
3210332103
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
3210432104
"function" ===
3210532105
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

compiled/facebook-www/ReactDOM-dev.modern.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31235,11 +31235,11 @@ __DEV__ &&
3123531235
return_targetInst = null;
3123631236
(function () {
3123731237
var isomorphicReactPackageVersion = React.version;
31238-
if ("19.2.0-www-modern-e130c08b-20250625" !== isomorphicReactPackageVersion)
31238+
if ("19.2.0-www-modern-123ff13b-20250625" !== isomorphicReactPackageVersion)
3123931239
throw Error(
3124031240
'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' +
3124131241
(isomorphicReactPackageVersion +
31242-
"\n - react-dom: 19.2.0-www-modern-e130c08b-20250625\nLearn more: https://react.dev/warnings/version-mismatch")
31242+
"\n - react-dom: 19.2.0-www-modern-123ff13b-20250625\nLearn more: https://react.dev/warnings/version-mismatch")
3124331243
);
3124431244
})();
3124531245
("function" === typeof Map &&
@@ -31282,10 +31282,10 @@ __DEV__ &&
3128231282
!(function () {
3128331283
var internals = {
3128431284
bundleType: 1,
31285-
version: "19.2.0-www-modern-e130c08b-20250625",
31285+
version: "19.2.0-www-modern-123ff13b-20250625",
3128631286
rendererPackageName: "react-dom",
3128731287
currentDispatcherRef: ReactSharedInternals,
31288-
reconcilerVersion: "19.2.0-www-modern-e130c08b-20250625"
31288+
reconcilerVersion: "19.2.0-www-modern-123ff13b-20250625"
3128931289
};
3129031290
internals.overrideHookState = overrideHookState;
3129131291
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
@@ -31885,7 +31885,7 @@ __DEV__ &&
3188531885
exports.useFormStatus = function () {
3188631886
return resolveDispatcher().useHostTransitionStatus();
3188731887
};
31888-
exports.version = "19.2.0-www-modern-e130c08b-20250625";
31888+
exports.version = "19.2.0-www-modern-123ff13b-20250625";
3188931889
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
3189031890
"function" ===
3189131891
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

compiled/facebook-www/ReactDOM-prod.classic.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19538,14 +19538,14 @@ function getCrossOriginStringAs(as, input) {
1953819538
}
1953919539
var isomorphicReactPackageVersion$jscomp$inline_2088 = React.version;
1954019540
if (
19541-
"19.2.0-www-classic-e130c08b-20250625" !==
19541+
"19.2.0-www-classic-123ff13b-20250625" !==
1954219542
isomorphicReactPackageVersion$jscomp$inline_2088
1954319543
)
1954419544
throw Error(
1954519545
formatProdErrorMessage(
1954619546
527,
1954719547
isomorphicReactPackageVersion$jscomp$inline_2088,
19548-
"19.2.0-www-classic-e130c08b-20250625"
19548+
"19.2.0-www-classic-123ff13b-20250625"
1954919549
)
1955019550
);
1955119551
Internals.findDOMNode = function (componentOrElement) {
@@ -19563,10 +19563,10 @@ Internals.Events = [
1956319563
];
1956419564
var internals$jscomp$inline_2701 = {
1956519565
bundleType: 0,
19566-
version: "19.2.0-www-classic-e130c08b-20250625",
19566+
version: "19.2.0-www-classic-123ff13b-20250625",
1956719567
rendererPackageName: "react-dom",
1956819568
currentDispatcherRef: ReactSharedInternals,
19569-
reconcilerVersion: "19.2.0-www-classic-e130c08b-20250625"
19569+
reconcilerVersion: "19.2.0-www-classic-123ff13b-20250625"
1957019570
};
1957119571
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
1957219572
var hook$jscomp$inline_2702 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -19978,4 +19978,4 @@ exports.useFormState = function (action, initialState, permalink) {
1997819978
exports.useFormStatus = function () {
1997919979
return ReactSharedInternals.H.useHostTransitionStatus();
1998019980
};
19981-
exports.version = "19.2.0-www-classic-e130c08b-20250625";
19981+
exports.version = "19.2.0-www-classic-123ff13b-20250625";

compiled/facebook-www/ReactDOM-prod.modern.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19271,14 +19271,14 @@ function getCrossOriginStringAs(as, input) {
1927119271
}
1927219272
var isomorphicReactPackageVersion$jscomp$inline_2078 = React.version;
1927319273
if (
19274-
"19.2.0-www-modern-e130c08b-20250625" !==
19274+
"19.2.0-www-modern-123ff13b-20250625" !==
1927519275
isomorphicReactPackageVersion$jscomp$inline_2078
1927619276
)
1927719277
throw Error(
1927819278
formatProdErrorMessage(
1927919279
527,
1928019280
isomorphicReactPackageVersion$jscomp$inline_2078,
19281-
"19.2.0-www-modern-e130c08b-20250625"
19281+
"19.2.0-www-modern-123ff13b-20250625"
1928219282
)
1928319283
);
1928419284
Internals.findDOMNode = function (componentOrElement) {
@@ -19296,10 +19296,10 @@ Internals.Events = [
1929619296
];
1929719297
var internals$jscomp$inline_2683 = {
1929819298
bundleType: 0,
19299-
version: "19.2.0-www-modern-e130c08b-20250625",
19299+
version: "19.2.0-www-modern-123ff13b-20250625",
1930019300
rendererPackageName: "react-dom",
1930119301
currentDispatcherRef: ReactSharedInternals,
19302-
reconcilerVersion: "19.2.0-www-modern-e130c08b-20250625"
19302+
reconcilerVersion: "19.2.0-www-modern-123ff13b-20250625"
1930319303
};
1930419304
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
1930519305
var hook$jscomp$inline_2684 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -19711,4 +19711,4 @@ exports.useFormState = function (action, initialState, permalink) {
1971119711
exports.useFormStatus = function () {
1971219712
return ReactSharedInternals.H.useHostTransitionStatus();
1971319713
};
19714-
exports.version = "19.2.0-www-modern-e130c08b-20250625";
19714+
exports.version = "19.2.0-www-modern-123ff13b-20250625";

0 commit comments

Comments
 (0)