use of com.perl5.lang.perl.psi.PerlSubExpr in project Perl5-IDEA by Camelcade.
the class MojoHelperWrapper method calcLightElementsFromPsi.
@NotNull
@Override
public List<PerlDelegatingLightNamedElement> calcLightElementsFromPsi() {
List<PsiElement> listElements = getCallArgumentsList();
if (listElements.size() != 2) {
return Collections.emptyList();
}
PsiElement identifierElement = listElements.get(0);
if (!isAcceptableIdentifierElement(identifierElement)) {
return Collections.emptyList();
}
PsiElement bodyElement = listElements.get(1);
// fixme we could handle reference here
if (!(bodyElement instanceof PerlSubExpr)) {
return Collections.emptyList();
}
String subName = ElementManipulators.getValueText(identifierElement);
if (StringUtil.isEmpty(subName)) {
return Collections.emptyList();
}
PsiPerlBlock subDefinitionBody = ((PerlSubExpr) bodyElement).getBlock();
return Collections.singletonList(new MojoHelperDefinition(this, subName, LIGHT_METHOD_DEFINITION, identifierElement, MOJO_CONTROLLER_NS, PerlSubDefinitionElement.getPerlSubArgumentsFromBody(subDefinitionBody), computeSubAnnotations(this, identifierElement), subDefinitionBody));
}
Aggregations