void (BiConsumer<? super PsiElement, ? super Collection<? extends DfaMemoryState>> consumer) { MultiMap<PsiElement, DfaMemoryState> closures = myInterpreter.getClosures(); for (PsiElement closure : closures.keySet()) { List<DfaVariableValue> unusedVars = StreamEx.of(getFactory().getValues()) .select(DfaVariableValue.class) .filter(var -> var.getQualifier() == null) .filter(var -> var.getPsiVariable() instanceof PsiVariable && !VariableAccessUtils.variableIsUsed((PsiVariable)var.getPsiVariable(), closure)) .toList(); Collection<DfaMemoryState> states = closures.get(closure); if (!unusedVars.isEmpty()) { List<DfaMemoryState> stateList = StreamEx.of(states) .peek(state -> state.flushVariables(unusedVars::contains)) .distinct().toList(); states = StateQueue.squash(stateList); } consumer.accept(closure, states); } }