mirror of
https://github.com/facebook/react.git
synced 2026-11-18 20:15:56 +00:00
Fix incorrectly recording declarations in reassignments in
PropagateScopeDependencies This was incorrectly added in #1190, oops!
This commit is contained in:
1 parent
b5a0739e8c
commit
759a7e027b
1 file changed
+12
-10
@@ -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