Skip to content

Commit

Permalink
NONLOCAL return in bodies
Browse files Browse the repository at this point in the history
  • Loading branch information
enebo committed Feb 10, 2015
1 parent ce9076c commit 92e4062
Showing 1 changed file with 6 additions and 0 deletions.
Expand Up @@ -10,6 +10,7 @@
import org.jruby.ir.instructions.Instr;
import org.jruby.ir.instructions.JumpInstr;
import org.jruby.ir.instructions.LineNumberInstr;
import org.jruby.ir.instructions.NonlocalReturnInstr;
import org.jruby.ir.instructions.ResultInstr;
import org.jruby.ir.instructions.ReturnBase;
import org.jruby.ir.instructions.RuntimeHelperCall;
Expand Down Expand Up @@ -67,6 +68,11 @@ public IRubyObject interpret(ThreadContext context, IRubyObject self, Interprete
switch (operation) {
case RETURN:
return (IRubyObject) retrieveOp(((ReturnBase) instr).getReturnValue(), context, self, currDynScope, currScope, temp);
case NONLOCAL_RETURN: {
NonlocalReturnInstr ri = (NonlocalReturnInstr)instr;
IRubyObject rv = (IRubyObject)retrieveOp(ri.getReturnValue(), context, self, currDynScope, currScope, temp);
return IRRuntimeHelpers.initiateNonLocalReturn(context, currDynScope, blockType, rv);
}
case LINE_NUM:
context.setLine(((LineNumberInstr) instr).lineNumber);
break;
Expand Down

0 comments on commit 92e4062

Please sign in to comment.