In my mainframe background, all compilations were printed. Part of the printout was a cross reference of all the variables: where they were defined and where used.

There have been a load of "shadowed" variables problems lately. If there were a way to create a variables cross reference listing for a program it would be possible to see that the variable defined on line 20 was also defined on line 44. In most cases this is an error. By looking at where each variable was used, you could see that the one defined on line 20 was never given a value.