dillon1000/react

Commit

[compiler] Always emit variable decl in gating mode

This PR makes it so we always emit a const VariableDeclaration for
compiled functions in gating mode. If the original declaration's parent
was an ExportDefaultDeclaration we'll also append a new
ExportDefaultDeclaration pointing to the new identifier. This allows
code that adds optional properties to the function declaration to still
work in gating mode

ghstack-source-id: 5705479135baa268eeb3c85bfbf1883964e84916
Pull Request resolved: https://github.com/facebook/react/pull/29806
Browse files
Changed paths6 files
First-parent comparison
M compiler/packages/babel-plugin-react-compiler/src/Entrypoint/Gating.ts ModifiedR compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/bug-gating-invalid-function-properties.expect.md →compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/gating-preserves-function-properties.expect.md RenamedR compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/bug-gating-invalid-function-properties.tsx →compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/gating-preserves-function-properties.tsx RenamedM compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/gating-test-export-default-function.expect.md ModifiedM compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/gating-test-export-function-and-default.expect.md ModifiedM compiler/packages/snap/src/SproutTodoFilter.ts Modified
Patch

Files changed

Rendering syntax-highlighted changes…