1616
1717package com .goide .psi .impl ;
1818
19+ import com .goide .psi .GoCompositeElement ;
1920import com .intellij .psi .PsiElement ;
20- import com .intellij .psi .PsiWhiteSpace ;
2121import com .intellij .psi .ResolveState ;
22- import com .intellij .psi .impl .source .tree .LeafPsiElement ;
2322import com .intellij .psi .scope .PsiScopeProcessor ;
2423import com .intellij .psi .util .PsiTreeUtil ;
2524import org .jetbrains .annotations .NotNull ;
@@ -44,7 +43,8 @@ public static boolean processChildren(@NotNull PsiElement element,
4443 @ NotNull PsiElement place ) {
4544 PsiElement run = lastParent == null ? element .getLastChild () : lastParent .getPrevSibling ();
4645 while (run != null ) {
47- if (PsiTreeUtil .findCommonParent (place , run ) != run && !run .processDeclarations (processor , substitutor , null , place )) {
46+ if (run instanceof GoCompositeElement && PsiTreeUtil .findCommonParent (place , run ) != run &&
47+ !run .processDeclarations (processor , substitutor , null , place )) {
4848 return false ;
4949 }
5050 run = run .getPrevSibling ();
@@ -59,7 +59,7 @@ public static boolean processChildrenFromTop(@NotNull PsiElement element,
5959 @ NotNull PsiElement place ) {
6060 PsiElement run = element .getFirstChild ();
6161 while (run != null ) {
62- if (!( run instanceof LeafPsiElement || run instanceof PsiWhiteSpace ) ) {
62+ if (run instanceof GoCompositeElement ) {
6363 if (run .isEquivalentTo (lastParent )) return true ;
6464 if (PsiTreeUtil .findCommonParent (place , run ) != run && !run .processDeclarations (processor , substitutor , null , place )) {
6565 return false ;
0 commit comments