mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
[hir] Treat values escaping into a contextref as Mutate
This commit is contained in:
@@ -783,8 +783,12 @@ function inferBlock(
|
||||
continue;
|
||||
}
|
||||
case "LoadLocal": {
|
||||
state.reference(instrValue.place, Effect.Capture);
|
||||
const lvalue = instr.lvalue;
|
||||
const effect =
|
||||
state.isDefined(lvalue) && state.kind(lvalue) === ValueKind.Context
|
||||
? Effect.Mutate
|
||||
: Effect.Capture;
|
||||
state.reference(instrValue.place, effect);
|
||||
lvalue.effect = Effect.Mutate;
|
||||
// direct aliasing: `a = b`;
|
||||
state.alias(lvalue, instrValue.place);
|
||||
|
||||
Reference in New Issue
Block a user