示例#1
0
 private static IRubyObject handleBreakJump(ThreadContext context, JumpException.BreakJump bj)
     throws JumpException.BreakJump {
   if (context.getFrameJumpTarget() == bj.getTarget()) {
     return (IRubyObject) bj.getValue();
   }
   throw bj;
 }
示例#2
0
 private IRubyObject handleBreakJump(
     Ruby runtime, Block newBlock, JumpException.BreakJump bj, int jumpTarget) {
   switch (newBlock.type) {
     case LAMBDA:
       if (bj.getTarget() == jumpTarget) {
         return (IRubyObject) bj.getValue();
       } else {
         throw runtime.newLocalJumpError(
             RubyLocalJumpError.Reason.BREAK, (IRubyObject) bj.getValue(), "unexpected break");
       }
     case PROC:
       if (newBlock.isEscaped()) {
         throw runtime.newLocalJumpError(
             RubyLocalJumpError.Reason.BREAK,
             (IRubyObject) bj.getValue(),
             "break from proc-closure");
       } else {
         throw bj;
       }
     default:
       throw bj;
   }
 }