Search in sources :

Example 1 with PerlCompositeElement

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

the class PerlPsiUtil method processNamespaceStatements.

public static boolean processNamespaceStatements(@NotNull PsiElement rootElement, Processor<PsiElement> processor) {
    PsiElement run = rootElement.getFirstChild();
    boolean result = true;
    while (run != null && result) {
        if (!(run instanceof PerlNamespaceDefinitionWithIdentifier)) {
            if (run instanceof PerlCompositeElement) {
                result = processor.process(run);
            }
            if (result && run instanceof PerlStatementsContainer) {
                result = processNamespaceStatements(run, processor);
            }
        }
        run = run.getNextSibling();
    }
    return result;
}
Also used : PerlStatementsContainer(com.perl5.lang.perl.psi.properties.PerlStatementsContainer) ASTWrapperPsiElement(com.intellij.extapi.psi.ASTWrapperPsiElement)

Example 2 with PerlCompositeElement

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

the class PerlResolveUtil method processChildren.

public static boolean processChildren(@NotNull PsiElement element, @NotNull PsiScopeProcessor processor, @NotNull ResolveState resolveState, @Nullable PsiElement lastParent, @NotNull PsiElement place) {
    PsiElement run = lastParent == null ? element.getLastChild() : lastParent.getPrevSibling();
    while (run != null) {
        ProgressManager.checkCanceled();
        if (run instanceof PerlCompositeElement && // fixme this should be in composite
        !(run instanceof PerlLexicalScope) && !run.processDeclarations(processor, resolveState, null, place)) {
            return false;
        }
        run = run.getPrevSibling();
    }
    // checking implicit variables fixme: decide, move processchildren to here or move this one to processDeclarations?
    if (element instanceof PerlImplicitVariablesProvider) {
        for (PerlVariableDeclarationElement wrapper : ((PerlImplicitVariablesProvider) element).getImplicitVariables()) {
            ProgressManager.checkCanceled();
            if (!processor.execute(wrapper, resolveState)) {
                return false;
            }
        }
    }
    return true;
}
Also used : PerlCompositeElement(com.perl5.lang.perl.psi.PerlCompositeElement) PerlVariableDeclarationElement(com.perl5.lang.perl.psi.PerlVariableDeclarationElement) PerlImplicitVariablesProvider(com.perl5.lang.perl.extensions.PerlImplicitVariablesProvider) PerlLexicalScope(com.perl5.lang.perl.psi.properties.PerlLexicalScope)

Aggregations

ASTWrapperPsiElement (com.intellij.extapi.psi.ASTWrapperPsiElement)1 PerlImplicitVariablesProvider (com.perl5.lang.perl.extensions.PerlImplicitVariablesProvider)1 PerlCompositeElement (com.perl5.lang.perl.psi.PerlCompositeElement)1 PerlVariableDeclarationElement (com.perl5.lang.perl.psi.PerlVariableDeclarationElement)1 PerlLexicalScope (com.perl5.lang.perl.psi.properties.PerlLexicalScope)1 PerlStatementsContainer (com.perl5.lang.perl.psi.properties.PerlStatementsContainer)1