boolean (PsiElement patternElement, PsiElement matchElement) { ProgressManager.checkCanceled(); if (patternElement == matchElement) return true; if (patternElement == null) { // absence of pattern element is match return true; } if (matchElement == null) { // absence of match element needs check if allowed. return allowsAbsenceOfMatch(patternElement); } // copy changed data to local stack final PsiElement prevElement = myElement; myElement = matchElement; try { final PsiElementVisitor visitor = getVisitorForElement(patternElement); if (visitor != null) { patternElement.accept(visitor); } } catch (ClassCastException ex) { myResult = false; } finally { myElement = prevElement; } return myResult; }