@Override
  public void visitClass(@NotNull PsiClass aClass) {
    startElement(aClass);
    List<PsiVariable> array = new ArrayList<>();
    // anonymous or local class
    if (aClass instanceof PsiAnonymousClass) {
      final PsiElement arguments = PsiTreeUtil.getChildOfType(aClass, PsiExpressionList.class);
      if (arguments != null) arguments.accept(this);
      PsiElement next = arguments != null ? arguments.getNextSibling() : aClass.getFirstChild();
      while (next != null) {
        addUsedVariables(array, next);
        next = next.getNextSibling();
      }
    }
    else {
      addUsedVariables(array, aClass);
    }

    for (PsiVariable var : array) {
      ProgressManager.checkCanceled();
      generateReadInstruction(var);
    }
    finishElement(aClass);
  }
@Override
  public void visitClass(@NotNull PsiClass aClass)