Skip to content

Commit 92e4062

Browse files
committed
NONLOCAL return in bodies
1 parent ce9076c commit 92e4062

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

core/src/main/java/org/jruby/ir/interpreter/BodyInterpreterEngine.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import org.jruby.ir.instructions.Instr;
1111
import org.jruby.ir.instructions.JumpInstr;
1212
import org.jruby.ir.instructions.LineNumberInstr;
13+
import org.jruby.ir.instructions.NonlocalReturnInstr;
1314
import org.jruby.ir.instructions.ResultInstr;
1415
import org.jruby.ir.instructions.ReturnBase;
1516
import org.jruby.ir.instructions.RuntimeHelperCall;
@@ -67,6 +68,11 @@ public IRubyObject interpret(ThreadContext context, IRubyObject self, Interprete
6768
switch (operation) {
6869
case RETURN:
6970
return (IRubyObject) retrieveOp(((ReturnBase) instr).getReturnValue(), context, self, currDynScope, currScope, temp);
71+
case NONLOCAL_RETURN: {
72+
NonlocalReturnInstr ri = (NonlocalReturnInstr)instr;
73+
IRubyObject rv = (IRubyObject)retrieveOp(ri.getReturnValue(), context, self, currDynScope, currScope, temp);
74+
return IRRuntimeHelpers.initiateNonLocalReturn(context, currDynScope, blockType, rv);
75+
}
7076
case LINE_NUM:
7177
context.setLine(((LineNumberInstr) instr).lineNumber);
7278
break;

0 commit comments

Comments
 (0)