Skip to content

Commit

Permalink
fixed files form Closure #127
Browse files Browse the repository at this point in the history
  • Loading branch information
tdurieux committed Mar 7, 2017
1 parent 07cede2 commit a101bcf
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,22 @@ private void tryRemoveUnconditionalBranching(Node n) {
outEdges.get(0).getValue() == Branch.UNCOND);
Node fallThrough = computeFollowing(n);
Node nextCfgNode = outEdges.get(0).getDestination().getValue();
if (nextCfgNode == fallThrough) {
if (nextCfgNode == fallThrough && !inFinally(n.getParent(), n)) {
removeNode(n);
}
}
}
}

private boolean inFinally(Node parent, Node child) {
if (parent == null || parent.isFunction()) {
return false;
} else if (NodeUtil.isTryFinallyNode(parent, child)) {
return true;
} else {
return inFinally(parent.getParent(), parent);
}
}

private Node computeFollowing(Node n) {
Node next = ControlFlowAnalysis.computeFollowNode(n);
Expand Down

0 comments on commit a101bcf

Please sign in to comment.