mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Fix incorrectly recording declarations in reassignments in
PropagateScopeDependencies This was incorrectly added in #1190, oops!
This commit is contained in:
@@ -380,14 +380,16 @@ function visitInstruction(context: Context, instr: ReactiveInstruction): void {
|
||||
if (lvalue == null) {
|
||||
return;
|
||||
}
|
||||
context.visitReassignment(lvalue);
|
||||
// TODO: only assign Const if the value is never reassigned
|
||||
const kind = context.isReactive(lvalue.place.identifier)
|
||||
? DeclKind.Dynamic
|
||||
: DeclKind.Const;
|
||||
context.declare(lvalue.place.identifier, {
|
||||
kind,
|
||||
id: lvalue.place.identifier.mutableRange.start,
|
||||
scope: context.currentScope,
|
||||
});
|
||||
if (lvalue.kind === InstructionKind.Reassign) {
|
||||
context.visitReassignment(lvalue);
|
||||
} else {
|
||||
const kind = context.isReactive(lvalue.place.identifier)
|
||||
? DeclKind.Dynamic
|
||||
: DeclKind.Const;
|
||||
context.declare(lvalue.place.identifier, {
|
||||
kind,
|
||||
id: lvalue.place.identifier.mutableRange.start,
|
||||
scope: context.currentScope,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user