boolean (@NotNull PsiElement element, @NotNull Processor<? super PsiElement> consumer) { if (element instanceof PyElement) { PsiElement finalElement = element; boolean isInsideStub = ReadAction.compute(() -> PyiUtil.isInsideStub(finalElement)); if (isInsideStub) { var originalElement = ReadAction.compute(() -> PyiUtil.getOriginalElement((PyElement)finalElement)); if (originalElement != null) { element = originalElement; if (!consumer.process(element)) return false; } } } if (element instanceof PyClass) { return processInheritors((PyClass)element, consumer); } else if (element instanceof PyFunction) { return processOverridingMethods((PyFunction)element, consumer); } else if (element instanceof PyTargetExpression) { return processAssignmentStatement(element, consumer); } return true; }