void (PsiElement patternNode, boolean typedVar, PsiElement matchNode) { final MatchResultImpl ourResult = matchContext.hasResult() ? matchContext.getResult() : null; matchContext.popResult(); if (myResult) { if (typedVar) { final SubstitutionHandler handler = (SubstitutionHandler)matchContext.getPattern().getHandler(patternNode); if (ourResult != null) ourResult.setScopeMatch(true); handler.setNestedResult(ourResult); setResult(handler.handle(matchNode, matchContext)); final MatchResultImpl nestedResult = handler.getNestedResult(); if (nestedResult != null) { // some constraint prevent from adding copyResults(nestedResult); handler.setNestedResult(null); } } else if (ourResult != null) { copyResults(ourResult); } } }