There are many tools that we can use to show the dependencies between modules, source code files, classes, or functions etc. But there seems no tool for analyzing the dependencies between variables. Given a dependency graph of variables would be helpful for understanding and refactoring the code.
For example, if variable b is only used for calculating the value of variable c as follows:
b = a;
....
c = b + 2;
Maybe we could remove variable b to make the code more readable:
....
c = a + 2;
This kind of refactory may be hard if the code is very complex or has many bad smells.
Is there any tool that can analyze the dependencies between variables in c# or other programming languages?