Update on "[compiler] Prune all unused array destructure items during DCE"

We didn't originally support holes within array patterns, so DCE was only able to prune unused items from the end of an array pattern. Now that we support holes we can replace any unused item with a hole, and then just prune the items to the last identifier/spread entry.

Note: this was motivated by finding useState where either the state or setState go unused — both are strong indications that you're violating the rules in some way. By DCE-ing the unused portions of the useState destructuring we can easily check if you're ignoring either value.

[ghstack-poisoned]
This commit is contained in:
Joe Savona
2024-11-21 00:07:29 -05:00
parent fcbbc83b0f
commit dc2cf2506f

View File

@@ -6,7 +6,6 @@
*/
import {
ArrayPattern,
BlockId,
HIRFunction,
Identifier,