Search in sources :

Example 1 with GrScopeProcessorWithHints

use of org.jetbrains.plugins.groovy.lang.resolve.processors.GrScopeProcessorWithHints in project intellij-community by JetBrains.

the class GrUnresolvedAccessChecker method doCheckContainer.

private static boolean doCheckContainer(final PsiMethod patternMethod, PsiElement container, final String name) {
    final Ref<Boolean> result = new Ref<>(false);
    PsiScopeProcessor processor = new GrScopeProcessorWithHints(name, ClassHint.RESOLVE_KINDS_METHOD) {

        @Override
        public boolean execute(@NotNull PsiElement element, @NotNull ResolveState state) {
            if (element instanceof PsiMethod && name.equals(((PsiMethod) element).getName()) && patternMethod.getParameterList().getParametersCount() == ((PsiMethod) element).getParameterList().getParametersCount() && isNotFromGroovyObject((PsiMethod) element)) {
                result.set(true);
                return false;
            }
            return true;
        }
    };
    ResolveUtil.treeWalkUp(container, processor, true);
    return result.get();
}
Also used : Ref(com.intellij.openapi.util.Ref) GrScopeProcessorWithHints(org.jetbrains.plugins.groovy.lang.resolve.processors.GrScopeProcessorWithHints) PsiScopeProcessor(com.intellij.psi.scope.PsiScopeProcessor) NotNull(org.jetbrains.annotations.NotNull) GroovyPsiElement(org.jetbrains.plugins.groovy.lang.psi.GroovyPsiElement) GroovyDocPsiElement(org.jetbrains.plugins.groovy.lang.groovydoc.psi.api.GroovyDocPsiElement)

Aggregations

Ref (com.intellij.openapi.util.Ref)1 PsiScopeProcessor (com.intellij.psi.scope.PsiScopeProcessor)1 NotNull (org.jetbrains.annotations.NotNull)1 GroovyDocPsiElement (org.jetbrains.plugins.groovy.lang.groovydoc.psi.api.GroovyDocPsiElement)1 GroovyPsiElement (org.jetbrains.plugins.groovy.lang.psi.GroovyPsiElement)1 GrScopeProcessorWithHints (org.jetbrains.plugins.groovy.lang.resolve.processors.GrScopeProcessorWithHints)1