Fix incorrectly recording declarations in reassignments in

PropagateScopeDependencies 

This was incorrectly added in #1190, oops!
This commit is contained in:
Lauren Tan
2023-02-13 16:52:08 -05:00
parent b5a0739e8c
commit 759a7e027b
@@ -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,
});
}
}