facebookarchive / prepack

A JavaScript bundle optimizer.
http://prepack.io
Other
14.21k stars 424 forks source link

Filter ModifiedBindings by environment's creating optimized function #2551

Closed cblappert closed 6 years ago

cblappert commented 6 years ago

Release Notes: None

Changes the logic for determining which ModifiedBindings need serialization to work properly in the face of nested optimized functions. We should only serialize ModifiedBindings if their environment was not created by the optimized function or its children (i.e. the binding should not be local to the optimized function).

This also solves the issue that React components don't have a parent chain which is important for properly handling nested optimized functions. Solves #2550.

Solves #2430, Solves #2426, Solves #2423, Solves #2422 (some were solved by previous PRs, just adding the tests here as well).

NTillmann commented 6 years ago

Checking the branch, I saw that there are still a bunch of remnants of environmentRecordIdAfterGlobalCode around. Please remove them all.