use of jadx.core.dex.regions.conditions.IfCondition in project jadx by skylot.
the class IfMakerHelper method mergeIfInfo.
private static IfInfo mergeIfInfo(IfInfo first, IfInfo second, boolean followThenBranch) {
Mode mergeOperation = followThenBranch ? Mode.AND : Mode.OR;
IfCondition condition = IfCondition.merge(mergeOperation, first.getCondition(), second.getCondition());
// skip synthetic successor if both parts leads to same block
BlockNode thenBlock;
BlockNode elseBlock;
if (followThenBranch) {
thenBlock = second.getThenBlock();
elseBlock = getCrossBlock(first.getElseBlock(), second.getElseBlock());
} else {
thenBlock = getCrossBlock(first.getThenBlock(), second.getThenBlock());
elseBlock = second.getElseBlock();
}
IfInfo result = new IfInfo(condition, thenBlock, elseBlock);
result.setIfBlock(first.getIfBlock());
result.merge(first, second);
BlockNode otherPathBlock = followThenBranch ? first.getElseBlock() : first.getThenBlock();
skipSimplePath(otherPathBlock, result.getSkipBlocks());
return result;
}
Aggregations