use of com.perl5.lang.perl.psi.stubs.calls.PerlSubCallElementStub in project Perl5-IDEA by Camelcade.
the class PerlSubCallElement method getSubName.
@Nullable
public String getSubName() {
PerlSubCallElementStub stub = getGreenStub();
if (stub != null) {
return stub.getSubName();
}
PsiPerlMethod method = getMethod();
if (method == null) {
return null;
}
PerlSubNameElement subNameElement = method.getSubNameElement();
return subNameElement == null ? null : subNameElement.getName();
}
use of com.perl5.lang.perl.psi.stubs.calls.PerlSubCallElementStub 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