List<PsiVariable> (@NotNull ControlFlow flow, int start, int end) { List<PsiVariable> array = new ArrayList<>(); if (start < 0) return array; List<Instruction> instructions = flow.getInstructions(); for (int i = start; i < end; i++) { Instruction instruction = instructions.get(i); if (instruction instanceof ReadVariableInstruction) { PsiVariable variable = ((ReadVariableInstruction)instruction).variable; if (!array.contains(variable)) { array.add(variable); } } else if (instruction instanceof WriteVariableInstruction) { PsiVariable variable = ((WriteVariableInstruction)instruction).variable; if (!array.contains(variable)) { array.add(variable); } } } return array; }