Search in sources :

Example 1 with PerlMooseOverrideStatement

use of com.perl5.lang.perl.parser.moose.psi.impl.PerlMooseOverrideStatement in project Perl5-IDEA by Camelcade.

the class PerlMooseSuperReference method resolveInner.

@NotNull
@Override
protected ResolveResult[] resolveInner(boolean incompleteCode) {
    // fixme not really dry with simpleresolver and superresolver. Need some generics magic
    List<ResolveResult> result = new ArrayList<>();
    PsiElement element = getElement();
    PerlMooseOverrideStatement overrideStatement = PsiTreeUtil.getParentOfType(element, PerlMooseOverrideStatement.class);
    if (overrideStatement != null) {
        String packageName = PerlPackageUtil.getContextPackageName(element);
        String subName = overrideStatement.getSubName();
        Project project = element.getProject();
        for (PsiElement targetElement : PerlMro.resolveSub(project, packageName, subName, true)) {
            result.add(new PsiElementResolveResult(targetElement));
        }
    }
    return result.toArray(new ResolveResult[result.size()]);
}
Also used : Project(com.intellij.openapi.project.Project) PerlMooseOverrideStatement(com.perl5.lang.perl.parser.moose.psi.impl.PerlMooseOverrideStatement) ArrayList(java.util.ArrayList) PsiElementResolveResult(com.intellij.psi.PsiElementResolveResult) PsiElementResolveResult(com.intellij.psi.PsiElementResolveResult) ResolveResult(com.intellij.psi.ResolveResult) PsiElement(com.intellij.psi.PsiElement) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

Project (com.intellij.openapi.project.Project)1 PsiElement (com.intellij.psi.PsiElement)1 PsiElementResolveResult (com.intellij.psi.PsiElementResolveResult)1 ResolveResult (com.intellij.psi.ResolveResult)1 PerlMooseOverrideStatement (com.perl5.lang.perl.parser.moose.psi.impl.PerlMooseOverrideStatement)1 ArrayList (java.util.ArrayList)1 NotNull (org.jetbrains.annotations.NotNull)1