Search in sources :

Example 1 with PsiLocalVariableImpl

use of com.intellij.psi.impl.source.tree.java.PsiLocalVariableImpl in project intellij-community by JetBrains.

the class ResolverProcessorImpl method execute.

@Override
public boolean execute(@NotNull PsiElement element, @NotNull ResolveState state) {
    if (element instanceof PsiLocalVariableImpl) {
        // the debugger creates a Java code block context and our expressions to evaluate resolve there
        return true;
    }
    if (myResolveTargetKinds == null || myResolveTargetKinds.contains(getDeclarationKind(element))) {
        //don't check field for name because they can be aliased imported
        if (element instanceof PsiVariable && !(element instanceof PsiField) && myName != null && !myName.equals(((PsiVariable) element).getName())) {
            return true;
        }
        PsiNamedElement namedElement = (PsiNamedElement) element;
        PsiSubstitutor substitutor = state.get(PsiSubstitutor.KEY);
        if (substitutor == null)
            substitutor = PsiSubstitutor.EMPTY;
        if (myTypeArguments.length > 0 && namedElement instanceof PsiClass) {
            substitutor = substitutor.putAll((PsiClass) namedElement, myTypeArguments);
        }
        if (namedElement instanceof PsiClass && !(namedElement instanceof PsiTypeParameter)) {
            final PsiClass aClass = (PsiClass) namedElement;
            if (myProcessedClasses == null)
                myProcessedClasses = new HashSet<>();
            if (!myProcessedClasses.add(aClass.getQualifiedName())) {
                return true;
            }
        }
        boolean isAccessible = isAccessible(namedElement);
        final PsiElement resolveContext = state.get(RESOLVE_CONTEXT);
        final SpreadState spreadState = state.get(SpreadState.SPREAD_STATE);
        boolean isStaticsOK = isStaticsOK(namedElement, resolveContext, false);
        addCandidate(new GroovyResolveResultImpl(namedElement, resolveContext, spreadState, substitutor, isAccessible, isStaticsOK));
        return !(isAccessible && isStaticsOK);
    }
    return true;
}
Also used : PsiLocalVariableImpl(com.intellij.psi.impl.source.tree.java.PsiLocalVariableImpl) SpreadState(org.jetbrains.plugins.groovy.lang.psi.api.SpreadState) GroovyResolveResultImpl(org.jetbrains.plugins.groovy.lang.psi.impl.GroovyResolveResultImpl) HashSet(java.util.HashSet)

Aggregations

PsiLocalVariableImpl (com.intellij.psi.impl.source.tree.java.PsiLocalVariableImpl)1 HashSet (java.util.HashSet)1 SpreadState (org.jetbrains.plugins.groovy.lang.psi.api.SpreadState)1 GroovyResolveResultImpl (org.jetbrains.plugins.groovy.lang.psi.impl.GroovyResolveResultImpl)1