You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[compiler][bugfix] Returned functions are not always frozen (#33047)
Fixes an edge case in React Compiler's effects inference model.
Returned values should only be typed as 'frozen' if they are (1) local
and (2) not a function expression which may capture and mutate this
function's outer context. See test fixtures for details
---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/facebook/react/pull/33047).
* #32765
* #32747
* __->__ #33047
DiffTrain build for [12f4cb8](12f4cb8)
return new InferenceState(this.env, new Map(__classPrivateFieldGet(this, _InferenceState_values, "f")), new Map(__classPrivateFieldGet(this, _InferenceState_variables, "f")));
46344
+
return new InferenceState(this.env, __classPrivateFieldGet(this, _InferenceState_isFunctionExpression, "f"), new Map(__classPrivateFieldGet(this, _InferenceState_values, "f")), new Map(__classPrivateFieldGet(this, _InferenceState_variables, "f")));
46340
46345
}
46341
46346
debug() {
46342
46347
const result = { values: {}, variables: {} };
@@ -46373,7 +46378,7 @@ class InferenceState {
46373
46378
}
46374
46379
}
46375
46380
}
46376
-
_InferenceState_values = new WeakMap(), _InferenceState_variables = new WeakMap();
46381
+
_InferenceState_isFunctionExpression = new WeakMap(), _InferenceState_values = new WeakMap(), _InferenceState_variables = new WeakMap();
46377
46382
function inferParam(param, initialState, paramKind) {
46378
46383
let value;
46379
46384
let place;
@@ -47064,7 +47069,9 @@ function inferBlock(env, state, block, functionEffects) {
47064
47069
let effect;
47065
47070
if (block.terminal.kind === 'return' || block.terminal.kind === 'throw') {
0 commit comments