use of com.perl5.lang.perl.psi.stubs.calls.PerlSubCallElementData in project Perl5-IDEA by Camelcade.
the class PerlClassAccessorHandler method isFollowBestPractice.
static boolean isFollowBestPractice(@NotNull PerlSubCallElement psiElement) {
PerlSubCallElementStub stub = psiElement.getGreenStub();
if (stub != null) {
PerlSubCallElementData callData = stub.getCallData();
LOG.assertTrue(callData instanceof PerlClassAccessorCallData, "Got: " + callData);
return ((PerlClassAccessorCallData) callData).isFBP();
}
return CachedValuesManager.getCachedValue(psiElement, () -> {
Ref<Boolean> result = Ref.create(Boolean.FALSE);
// fixme we need a smarter treewalkup here, scopes are not necessary here
PerlResolveUtil.treeWalkUp(psiElement, (element, state) -> {
if (element instanceof PsiPerlNamespaceContent) {
return false;
}
if (element instanceof PerlSubCallElement && StringUtil.equals("follow_best_practice", ((PerlSubCallElement) element).getSubName())) {
result.set(Boolean.TRUE);
return false;
}
return true;
});
return CachedValueProvider.Result.create(result.get(), psiElement);
}) == Boolean.TRUE;
}
Aggregations