AS to test whether global variables are actually used in a script?

Some of my AppleScript applications have evolved over many years to work with changes in macOS, and some global variables have become obsolete - they’re no longer used in the actual code.

Is there any way to test whether a global is used in the script? Is there possibly an AppleScript that can check on this? If no one has written one, I’ll try on my own, but I would prefer not to reinvent the wheel.