public boolean isVariableUsed(@NotNull PsiVariable variable, @NotNull PsiElement context) {
    for (PsiReference reference : myLocalRefsMap.get(variable.getNavigationElement())) {
      if (PsiTreeUtil.isAncestor(context, reference.getElement(), false)) return true;
    }
    return false;
  }
public boolean isVariableUsed(@NotNull PsiVariable variable, @NotNull PsiElement context)