Unverified Commit 23305421 authored by Wu Yongzheng's avatar Wu Yongzheng Committed by GitHub

fix issue #184

please refer to https://github.com/skylot/jadx/issues/184
parent 0e2c4d4a
......@@ -453,15 +453,18 @@ public class BlockUtils {
*/
public static List<BlockNode> collectBlocksDominatedBy(BlockNode dominator, BlockNode start) {
List<BlockNode> result = new ArrayList<BlockNode>();
collectWhileDominates(dominator, start, result);
HashSet<BlockNode> visited = new HashSet<BlockNode>();
collectWhileDominates(dominator, start, result, visited);
return result;
}
private static void collectWhileDominates(BlockNode dominator, BlockNode child, List<BlockNode> result) {
private static void collectWhileDominates(BlockNode dominator, BlockNode child, List<BlockNode> result, HashSet<BlockNode> visited) {
if (visited.contains(child)) return;
visited.add(child);
for (BlockNode node : child.getCleanSuccessors()) {
if (node.isDominator(dominator)) {
result.add(node);
collectWhileDominates(dominator, node, result);
collectWhileDominates(dominator, node, result, visited);
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment