boolean (@NotNull PsiScopeProcessor processor, @NotNull ResolveState state, PsiElement lastParent, @NotNull PsiElement place) { processor.handleEvent(PsiScopeProcessor.Event.SET_DECLARATION_HOLDER, this); ElementClassHint elementClassHint = processor.getHint(ElementClassHint.KEY); if (elementClassHint != null && !elementClassHint.shouldProcess(ElementClassHint.DeclarationKind.VARIABLE)) return true; if (lastParent == null) { // Only patterns may introduce variables visible after loop return PsiWhileStatementImpl.processDeclarationsInLoopCondition(processor, state, place, this); } else if (lastParent.getParent() != this) { // Parent element should not see our vars return true; } PsiStatement initialization = getInitialization(); if (initialization != null && lastParent != initialization) { if (!initialization.processDeclarations(processor, state, null, place)) return false; } PsiExpression condition = getCondition(); if (condition != null && (lastParent == getBody() || lastParent == getUpdate())) { return condition.processDeclarations(processor, PatternResolveState.WHEN_TRUE.putInto(state), null, place); } return true; }