List<Instruction> (@NotNull List<Instruction> graph, int start, int end) { List<Instruction> instructions = new ArrayList<>(); for (Instruction instruction : graph) { final PsiElement element = instruction.getElement(); if (element != null) { if (CodeFragmentUtil.getPosition(element, start, end) == Position.INSIDE) { instructions.add(instruction); } } } // Hack for including inner assert type instructions that can point to elements outside of the selected scope for (Instruction instruction : graph) { if (instruction instanceof ReadWriteInstruction readWriteInstruction) { if (readWriteInstruction.getAccess().isAssertTypeAccess()) { boolean innerAssertType = true; for (Instruction next : readWriteInstruction.allSucc()) { if (!instructions.contains(next)) { innerAssertType = false; break; } } if (innerAssertType && !instructions.contains(instruction)) { instructions.add(instruction); } } } } return instructions; }