Skip to content

Commit

Permalink
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions core/src/main/java/org/jruby/ir/IRBuilder.java
Original file line number Diff line number Diff line change
@@ -2251,8 +2251,9 @@ public Operand buildEnsureInternal(Node ensureBodyNode, Node ensurerNode) {
activeRescuers.pop();

// Clone the ensure body and jump to the end.
// Don't bother if the protected body ended in a return.
if (rv != U_NIL && !(ensureBodyNode instanceof RescueNode)) {
// Don't bother if the protected body ended in a return
// OR if we are really processing a rescue node
if (ensurerNode != null && rv != U_NIL && !(ensureBodyNode instanceof RescueNode)) {
ebi.cloneIntoHostScope(this);
addInstr(new JumpInstr(ebi.end));
}
@@ -3069,9 +3070,8 @@ private Operand buildRescueInternal(RescueNode rescueNode, EnsureBlockInfo ensur
activeRescuers.pop();

// Else part of the body -- we simply fall through from the main body if there were no exceptions
Label elseLabel = rescueNode.getElseNode() == null ? null : getNewLabel();
if (elseLabel != null) {
addInstr(new LabelInstr(elseLabel));
if (rescueNode.getElseNode() != null) {
addInstr(new LabelInstr(getNewLabel()));
tmp = build(rescueNode.getElseNode());
}

0 comments on commit f5d4913

Please sign in to comment.