Commit 3ffcfcb
committed
[compiler][poc] Reuse ValidateExhaustiveDeps for effect dep validation
Alternative approach to #35282 for validating effect deps in the compiler that builds on the machinery in ValidateExhaustiveDependencies. Key changes to that pass:
* Refactor to track the dependencies of array expressions as temporaries so we can look them up later if they appear as effect deps.
* Instead of not storing temporaries for LoadLocals of locally created variables, we store the temporary but also propagate the local-ness through. This allows us to record deps at the top level, necessary for effect deps. Previously the pass was only ever concerned with tracking deps within function expressions.
* Refactor the bulk of the dependency-checking logic from `onFinishMemoize()` into a standalone helper to use it for the new `onEffect()` helper as well.
A few important remaining todos:
* Add a new ErrorCategory for effect deps, use it for errors on effects
* Put the effect dep validation behind a feature flag
* Adjust the error reason for effect errors
Testing it locally on fixtures this looks ballpark right but i didn't do an exhaustive test.1 parent 0526c79 commit 3ffcfcb
File tree
1 file changed
+350
-242
lines changed- compiler/packages/babel-plugin-react-compiler/src/Validation
1 file changed
+350
-242
lines changed
0 commit comments