[compiler][newinference] Improve hoisted functions, validation of mutate-after-render
Updates ValidateNoFreezingMutableFunctions to account for indirections, where the frozen function calls another function that actually does the mutation. We just need to propagate on the mutation. Also some fixes for hoisted functions, DeclareContext can actually appear twice, so we need to check that subsequent (re)declarations are treated as a mutation, not a creation. ghstack-source-id: 8b05494224bbc647221fa798a66b097fcb3c442b Pull Request resolved: https://github.com/facebook/react/pull/33470
Showing
- compiler/packages/babel-plugin-react-compiler/src/Entrypoint/Pipeline.ts 1 addition, 0 deletions...es/babel-plugin-react-compiler/src/Entrypoint/Pipeline.ts
- compiler/packages/babel-plugin-react-compiler/src/Inference/InferMutationAliasingEffects.ts 56 additions, 18 deletions...ct-compiler/src/Inference/InferMutationAliasingEffects.ts
- compiler/packages/babel-plugin-react-compiler/src/Inference/InferMutationAliasingRanges.ts 4 additions, 4 deletions...act-compiler/src/Inference/InferMutationAliasingRanges.ts
- compiler/packages/babel-plugin-react-compiler/src/Validation/ValidateNoFreezingKnownMutableFunctions.ts 23 additions, 3 deletions...src/Validation/ValidateNoFreezingKnownMutableFunctions.ts
- compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.mutable-range-shared-inner-outer-function.js 1 addition, 1 deletion...mpiler/error.mutable-range-shared-inner-outer-function.js
- compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/new-mutability/error.invalid-reassign-local-variable-in-jsx-callback.expect.md 108 additions, 0 deletions...invalid-reassign-local-variable-in-jsx-callback.expect.md
- compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/new-mutability/error.invalid-reassign-local-variable-in-jsx-callback.js 32 additions, 0 deletions.../error.invalid-reassign-local-variable-in-jsx-callback.js
Please register or sign in to comment