code: private int getLocalVarIndex(Var v) {
      int num = v.index;
      Scope s = v.scope.getParent();
      if (s == null) {
        throw new IllegalArgumentException("Var is not local");
      }
  
      boolean isBleedingIntoScope = s.getParent() != null && localBleedingFunctions.contains(v);
  
      while (s.getParent() != null) {
        if (isBleedingIntoScope) {
          num += localBleedingFunctionsPerScope.get(s).indexOf(v) + 1;
          isBleedingIntoScope = false;
        } else {
          num += localBleedingFunctionsPerScope.get(s).size();
        }
        if (shouldTemporarilyRenameLocalsInScope(s)) {
          num += s.getVarCount();
        }
        s = s.getParent();
      }
      return num;
    }
docs: Returns the index within the scope stack.
  e.g. function Foo(a) { var b; function c(d) { } }
  a = 0, b = 1, c = 2, d = 3