Search in sources :

Example 1 with InsnContainer

use of jadx.core.dex.nodes.InsnContainer in project jadx by skylot.

the class RegionMakerVisitor method insertEdgeInsn.

/**
	 * Insert insn block from edge insn attribute.
	 */
private static void insertEdgeInsn(Region region) {
    List<IContainer> subBlocks = region.getSubBlocks();
    if (subBlocks.isEmpty()) {
        return;
    }
    IContainer last = subBlocks.get(subBlocks.size() - 1);
    List<EdgeInsnAttr> edgeInsnAttrs = last.getAll(AType.EDGE_INSN);
    if (edgeInsnAttrs.isEmpty()) {
        return;
    }
    EdgeInsnAttr insnAttr = edgeInsnAttrs.get(0);
    if (!insnAttr.getStart().equals(last)) {
        return;
    }
    List<InsnNode> insns = Collections.singletonList(insnAttr.getInsn());
    region.add(new InsnContainer(insns));
}
Also used : InsnNode(jadx.core.dex.nodes.InsnNode) InsnContainer(jadx.core.dex.nodes.InsnContainer) IContainer(jadx.core.dex.nodes.IContainer) EdgeInsnAttr(jadx.core.dex.attributes.nodes.EdgeInsnAttr)

Example 2 with InsnContainer

use of jadx.core.dex.nodes.InsnContainer in project jadx by skylot.

the class RegionMakerVisitor method addBreakToContainer.

private static void addBreakToContainer(Region c) {
    if (RegionUtils.hasExitEdge(c)) {
        return;
    }
    List<InsnNode> insns = new ArrayList<InsnNode>(1);
    insns.add(new InsnNode(InsnType.BREAK, 0));
    c.add(new InsnContainer(insns));
}
Also used : InsnNode(jadx.core.dex.nodes.InsnNode) InsnContainer(jadx.core.dex.nodes.InsnContainer) ArrayList(java.util.ArrayList)

Aggregations

InsnContainer (jadx.core.dex.nodes.InsnContainer)2 InsnNode (jadx.core.dex.nodes.InsnNode)2 EdgeInsnAttr (jadx.core.dex.attributes.nodes.EdgeInsnAttr)1 IContainer (jadx.core.dex.nodes.IContainer)1 ArrayList (java.util.ArrayList)1