DFAMap<ScopeVariable> (final DFAMap<ScopeVariable> map, final Instruction instruction) { final PsiElement element = instruction.getElement(); if (element == null || ((PyFile) element.getContainingFile()).getLanguageLevel().isPython2()){ return processReducedMap(map, instruction, element); } // Scope reduction final DFAMap<ScopeVariable> reducedMap = new DFAMap<>(); for (Map.Entry<String, ScopeVariable> entry : map.entrySet()) { final ScopeVariable value = entry.getValue(); // Support PEP-3110. (PY-1408) if (value.isParameter()){ final PsiElement declaration = value.getDeclarations().iterator().next(); final PyExceptPart exceptPart = PyExceptPartNavigator.getPyExceptPartByTarget(declaration); if (exceptPart != null){ if (!PsiTreeUtil.isAncestor(exceptPart, element, false)){ continue; } } } reducedMap.put(entry.getKey(), value); } return processReducedMap(reducedMap, instruction, element); }