Search in sources :

Example 1 with PerlMethodMixin

use of com.perl5.lang.perl.psi.mixins.PerlMethodMixin in project Perl5-IDEA by Camelcade.

the class PerlParameterInfoHandler method getMethodCallArguments.

@Nullable
private static PerlParameterInfo[] getMethodCallArguments(@NotNull PsiPerlCallArgumentsImpl arguments) {
    PsiElement run = arguments.getPrevSibling();
    while (run != null) {
        if (run instanceof PerlMethodMixin) {
            PerlSubNameElement subNameElement = ((PerlMethodMixin) run).getSubNameElement();
            if (subNameElement == null) {
                break;
            }
            PerlParameterInfo[] parameterInfos;
            for (PsiReference reference : subNameElement.getReferences()) {
                if (reference instanceof PsiPolyVariantReference) {
                    for (ResolveResult resolveResult : ((PsiPolyVariantReference) reference).multiResolve(false)) {
                        parameterInfos = getTargetParameterInfo(resolveResult.getElement());
                        if (parameterInfos != null) {
                            return parameterInfos;
                        }
                    }
                } else {
                    parameterInfos = getTargetParameterInfo(reference.resolve());
                    if (parameterInfos != null) {
                        return parameterInfos;
                    }
                }
            }
        }
        run = run.getPrevSibling();
    }
    return null;
}
Also used : PerlMethodMixin(com.perl5.lang.perl.psi.mixins.PerlMethodMixin) PerlSubNameElement(com.perl5.lang.perl.psi.PerlSubNameElement) PsiReference(com.intellij.psi.PsiReference) ResolveResult(com.intellij.psi.ResolveResult) PsiElement(com.intellij.psi.PsiElement) PsiPolyVariantReference(com.intellij.psi.PsiPolyVariantReference) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

PsiElement (com.intellij.psi.PsiElement)1 PsiPolyVariantReference (com.intellij.psi.PsiPolyVariantReference)1 PsiReference (com.intellij.psi.PsiReference)1 ResolveResult (com.intellij.psi.ResolveResult)1 PerlSubNameElement (com.perl5.lang.perl.psi.PerlSubNameElement)1 PerlMethodMixin (com.perl5.lang.perl.psi.mixins.PerlMethodMixin)1 Nullable (org.jetbrains.annotations.Nullable)1