use of com.perl5.lang.perl.psi.stubs.PerlPolyNamedElementStub in project Perl5-IDEA by Camelcade.
the class PerlClassAccessorWrapper method isFollowBestPractice.
public boolean isFollowBestPractice() {
PerlPolyNamedElementStub stub = getStub();
if (stub != null) {
return ((PerlClassAccessorWrapperStub) stub).isFollowBestPractice();
}
PerlClassAccessorWrapperStub greenStub = getGreenStub();
if (greenStub != null) {
return greenStub.isFollowBestPractice();
}
boolean[] result = new boolean[] { false };
// fixme we need a smarter treewalkup here, scopes are not necessary here
PerlResolveUtil.treeWalkUp(this, (element, state) -> {
if (element instanceof PsiPerlNamespaceContent) {
return false;
}
if (PsiUtilCore.getElementType(element) == CLASS_ACCESSOR_FBP) {
result[0] = true;
return false;
}
return true;
});
return result[0];
}
use of com.perl5.lang.perl.psi.stubs.PerlPolyNamedElementStub in project Perl5-IDEA by Camelcade.
the class PerlPsiUtil method processElementsFromStubs.
public static boolean processElementsFromStubs(@Nullable Stub stub, @Nullable Processor<PsiElement> processor, @Nullable Class<? extends PsiElement> avoidPsiClass) {
if (stub == null || processor == null) {
return false;
}
for (Stub childStub : stub.getChildrenStubs()) {
ProgressManager.checkCanceled();
PsiElement childPsi = ((StubElement) childStub).getPsi();
if (!processor.process(childPsi)) {
return false;
}
if (// don't enter sublcasses
avoidPsiClass == null || !avoidPsiClass.isInstance(childPsi)) {
if (!processElementsFromStubs(childStub, processor, avoidPsiClass)) {
return false;
}
}
}
if (stub instanceof PerlPolyNamedElementStub) {
for (PsiElement child : ((PerlPolyNamedElementStub) stub).getPsi().getLightElements()) {
ProgressManager.checkCanceled();
if (!processor.process(child)) {
return false;
}
}
}
return true;
}
Aggregations