charly-vm icon indicating copy to clipboard operation
charly-vm copied to clipboard

Delete local variable declarations that are never read from

Open KCreate opened this issue 3 years ago • 0 comments

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.

KCreate avatar Jul 27 '22 21:07 KCreate