use of jadx.core.dex.nodes.IContainer in project jadx by skylot.
the class RegionMakerVisitor method processSwitch.
private static void processSwitch(MethodNode mth, SwitchRegion sw) {
for (IContainer c : sw.getBranches()) {
if (!(c instanceof Region)) {
continue;
}
Set<IBlock> blocks = new HashSet<IBlock>();
RegionUtils.getAllRegionBlocks(c, blocks);
if (blocks.isEmpty()) {
addBreakToContainer((Region) c);
continue;
}
for (IBlock block : blocks) {
if (!(block instanceof BlockNode)) {
continue;
}
BlockNode bn = (BlockNode) block;
for (BlockNode s : bn.getCleanSuccessors()) {
if (!blocks.contains(s) && !bn.contains(AFlag.SKIP) && !s.contains(AFlag.FALL_THROUGH)) {
addBreak(mth, c, bn);
break;
}
}
}
}
}
use of jadx.core.dex.nodes.IContainer in project jadx by skylot.
the class IfRegionVisitor method markElseIfChains.
/**
* Mark if-else-if chains
*/
private static void markElseIfChains(IfRegion ifRegion) {
if (hasSimpleReturnBlock(ifRegion.getThenRegion())) {
return;
}
IContainer elsRegion = ifRegion.getElseRegion();
if (elsRegion instanceof Region) {
List<IContainer> subBlocks = ((Region) elsRegion).getSubBlocks();
if (subBlocks.size() == 1 && subBlocks.get(0) instanceof IfRegion) {
subBlocks.get(0).add(AFlag.ELSE_IF_CHAIN);
elsRegion.add(AFlag.ELSE_IF_CHAIN);
}
}
}
Aggregations