dillon1000/react
Commit
Browse files [compiler] Collect temporaries and optional chains from inner functions (#31346)
Recursively collect identifier / property loads and optional chains from
inner functions. This PR is in preparation for #31200
Previously, we only did this in `collectHoistablePropertyLoads` to
understand hoistable property loads from inner functions.
1. collectTemporariesSidemap
2. collectOptionalChainSidemap
3. collectHoistablePropertyLoads
- ^ this recursively calls `collectTemporariesSidemap`,
`collectOptionalChainSidemap`, and `collectOptionalChainSidemap` on
inner functions
4. collectDependencies
Now, we have
1. collectTemporariesSidemap
- recursively record identifiers in inner functions. Note that we track
all temporaries in the same map as `IdentifierIds` are currently unique
across functions
2. collectOptionalChainSidemap
- recursively records optional chain sidemaps in inner functions
3. collectHoistablePropertyLoads
- (unchanged, except to remove recursive collection of temporaries)
4. collectDependencies
- unchanged: to be modified to recursively collect dependencies in next
PR
'
---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/facebook/react/pull/31346).
* #31202
* #31203
* #31201
* #31200
* __->__ #31346
* #31199Changed paths4 files
First-parent comparisoncompiler/packages/babel-plugin-react-compiler/src/HIR/CollectHoistablePropertyLoads.ts ModifiedM compiler/packages/babel-plugin-react-compiler/src/HIR/CollectOptionalChainDependencies.ts ModifiedM compiler/packages/babel-plugin-react-compiler/src/HIR/PropagateScopeDependenciesHIR.ts ModifiedM compiler/packages/babel-plugin-react-compiler/src/HIR/visitors.ts ModifiedPatch
Files changed
Rendering syntax-highlighted changes…