InferReactiveIdentifiers: fixpoint iteration is now unnecessary

I removed fixpoint iteration and all tests pass, which matches my intuition that 
it's really that we need strictly two passes. Removing to simplify and for 
performance (avoid unnecessary extra visits of the ast)
This commit is contained in:
Joe Savona
2023-02-14 15:24:01 -08:00
parent 2b47cac5fd
commit b1ee356805
@@ -119,23 +119,18 @@ export function inferReactiveIdentifiers(
reactivityMap.set(param.identifier, true);
}
const actuallyReactiveScopes = new Set<ReactiveScope>();
let prevScopesSize = -1;
// TODO(mofeiZ): avoid fixpoint iteration
while (actuallyReactiveScopes.size > prevScopesSize) {
prevScopesSize = actuallyReactiveScopes.size;
visitReactiveFunction(fn, visitor, reactivityMap);
visitReactiveFunction(fn, visitor, reactivityMap);
for (const [id, value] of reactivityMap) {
const { scope } = id;
if (value && scope != null) {
actuallyReactiveScopes.add(scope);
}
for (const [id, value] of reactivityMap) {
const { scope } = id;
if (value && scope != null) {
actuallyReactiveScopes.add(scope);
}
for (const [id, _] of reactivityMap) {
if (id.scope && actuallyReactiveScopes.has(id.scope)) {
reactivityMap.set(id, true);
}
}
for (const [id, _] of reactivityMap) {
if (id.scope && actuallyReactiveScopes.has(id.scope)) {
reactivityMap.set(id, true);
}
}
const result = new Set<Identifier>();