From a101bcf92e853e18e6599a8eab0d241bed3bbe5f Mon Sep 17 00:00:00 2001 From: tdurieux Date: Tue, 7 Mar 2017 13:25:19 +0100 Subject: [PATCH] fixed files form Closure #127 --- .../javascript/jscomp/UnreachableCodeElimination.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/projects/Closure/127/com/google/javascript/jscomp/UnreachableCodeElimination.java b/projects/Closure/127/com/google/javascript/jscomp/UnreachableCodeElimination.java index d819874..e6d88a8 100644 --- a/projects/Closure/127/com/google/javascript/jscomp/UnreachableCodeElimination.java +++ b/projects/Closure/127/com/google/javascript/jscomp/UnreachableCodeElimination.java @@ -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);