[be][DeriveMinimalDeps] Check current assumptions for conditional control flow

This commit is contained in:
Mofei Zhang
2024-03-27 20:26:13 -04:00
parent fd3ae0ca0a
commit a37f242f59
2 changed files with 18 additions and 2 deletions
@@ -6,7 +6,7 @@
*/
import { CompilerError } from "../CompilerError";
import { Identifier, ReactiveScopeDependency } from "../HIR";
import { GeneratedSource, Identifier, ReactiveScopeDependency } from "../HIR";
import { printIdentifier } from "../HIR/PrintHIR";
import { assertExhaustive } from "../Utils/utils";
@@ -490,6 +490,22 @@ function addSubtreeIntersection(
suggestions: null,
});
CompilerError.invariant(
otherProperties.every((otherNode) => {
for (const [_, node] of otherNode) {
if (!isUnconditional(node.accessType)) {
return false;
}
}
return true;
}),
{
reason:
"[DeriveMinimalDependencies] Expected otherProperties to only hold unconditional nodes",
loc: GeneratedSource,
}
);
/*
* otherProperties here may contain unconditional nodes as the result of
* recursively merging exhaustively conditional children with unconditionally
@@ -446,7 +446,7 @@ class Context {
}
if (this.#checkValidDependency(maybeDependency)) {
this.#depsInCurrentConditional.add(maybeDependency, true);
this.#depsInCurrentConditional.add(maybeDependency, false);
/*
* Add info about this dependency to the existing tree
* We do not try to join/reduce dependencies here due to missing info