void (SequenceStatement seq, int index) { Statement first = seq.getStats().get(index); Statement pre = seq.getStats().get(index - 1); pre.removeSuccessor(pre.getAllSuccessorEdges().get(0)); // single regular edge StatEdge edge = first.getPredecessorEdges(EdgeType.BREAK).get(0); Statement source = edge.getSource(); Statement parent = source.getParent(); source.removeSuccessor(edge); List<Statement> lst = new ArrayList<>(); for (int i = seq.getStats().size() - 1; i >= index; i--) { lst.add(0, seq.getStats().remove(i)); } if (parent.type == StatementType.IF && ((IfStatement)parent).iftype == IfStatement.IFTYPE_IF && source == parent.getFirst()) { IfStatement ifparent = (IfStatement)parent; SequenceStatement block = new SequenceStatement(lst); block.setAllParent(); StatEdge newedge = new StatEdge(EdgeType.REGULAR, source, block); source.addSuccessor(newedge); ifparent.setIfEdge(newedge); ifparent.setIfstat(block); ifparent.getStats().addWithKey(block, block.id); block.setParent(ifparent); } else { lst.add(0, source); SequenceStatement block = new SequenceStatement(lst); block.setAllParent(); parent.replaceStatement(source, block); // LabelHelper.lowContinueLabels not applicable because of forward continue edges // LabelHelper.lowContinueLabels(block, new HashSet<StatEdge>()); // do it by hand for (StatEdge prededge : block.getPredecessorEdges(EdgeType.CONTINUE)) { block.removePredecessor(prededge); prededge.getSource().changeEdgeNode(EdgeDirection.FORWARD, prededge, source); source.addPredecessor(prededge); source.addLabeledEdge(prededge); } if (parent.type == StatementType.SWITCH) { ((SwitchStatement)parent).sortEdgesAndNodes(); } source.addSuccessor(new StatEdge(EdgeType.REGULAR, source, first)); } }