track reassignments separately from mutations

proxied-state-each-blocks
Rich Harris 1 year ago committed by Dominic Gannaway
parent 6d151ce444
commit 5a899c2244

@ -638,7 +638,10 @@ export function create_scopes(ast, root, allow_reactive_declarations, parent) {
} else {
extract_identifiers(node).forEach((identifier) => {
const binding = scope.get(identifier.name);
if (binding) binding.mutated = true;
if (binding) {
binding.mutated = true;
binding.reassigned = true;
}
});
}
}

@ -269,6 +269,7 @@ export interface Binding {
is_called: boolean;
references: { node: Identifier; path: SvelteNode[] }[];
mutated: boolean;
reassigned: boolean;
scope: Scope;
/** For `legacy_reactive`: its reactive dependencies */
legacy_dependencies: Binding[];

Loading…
Cancel
Save