mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
[be][DeriveMinimalDeps] Check current assumptions for conditional control flow
This commit is contained in:
+17
-1
@@ -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
|
||||
|
||||
+1
-1
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user