If I remember correctly, we use the IsEquivalentTo to figure out if we can get rid of variables with only a single reference and a constant initializer value. For instance,
var x = "prefix";
return x + bar;
would get minified to:
But in your general example, I can't safely
make that replacement every time because the variable is defined in one scope but referenced in another. I mean, yes: in this
example I could get rid of the var i = 1 and just have the function just return 1, but that isn't always true. So the IsEquivalentTo method won't say a variable is equivalent to the definition if they are in different scopes. Yes, they point
to the same field, so IsSameField returns true, but they aren't "equivalent" within the definition of also being in the same scope.