Variable declarations that are never read from can be safely removed. If the declaration has any side-effects, only those side effects must still be included, but the actual variable declaration must not.
This can be implemented by giving each declaration node a list of nodes that reference it, if that list if empty at the end of the block, the declaration can be removed.
Variable declarations that are never read from can be safely removed. If the declaration has any side-effects, only those side effects must still be included, but the actual variable declaration must not.
This can be implemented by giving each declaration node a list of nodes that reference it, if that list if empty at the end of the block, the declaration can be removed.