Object2IntMap<GrVariable> (@NotNull Object2IntMap<GrVariable> map, @NotNull Instruction instruction) { if (!(instruction instanceof ReadWriteVariableInstruction rwInstruction)) return map; if (!rwInstruction.isWrite()) return map; final GrVariable variable = getVariable(instruction.getElement()); if (variable == null) return map; int currentVal = map.getInt(variable); if (currentVal == 2) return map; if (currentVal == 0 || currentVal == 1 && !(variable.getParent() instanceof GrForInClause)) currentVal++; Object2IntMap<GrVariable> newMap = new Object2IntOpenHashMap<>(map); newMap.put(variable, currentVal); return newMap; }