@Override public IRubyObject yield( ThreadContext context, IRubyObject[] args, IRubyObject self, RubyModule klass, Binding binding, Block.Type type, Block block) { if (klass == null) { self = prepareSelf(binding); } IRubyObject[] preppedArgs = RubyProc.prepareArgs(context, type, arity, args); RubyArray value = context.runtime.newArrayNoCopyLight(preppedArgs); IRubyObject realArg = setupBlockArgs(context, value, self); Visibility oldVis = binding.getFrame().getVisibility(); Frame lastFrame = pre(context, klass, binding); try { return callback.call(context, self, realArg, block); } catch (JumpException.NextJump nj) { // A 'next' is like a local return from the block, ending this call or yield. return handleNextJump(context, nj, type); } finally { post(context, binding, oldVis, lastFrame); } }
// FIXME: These two duplicate overrides should go away @Override public IRubyObject yield( ThreadContext context, IRubyObject value, Binding binding, Block.Type type, Block block) { IRubyObject self = prepareSelf(binding); IRubyObject realArg = setupBlockArg(context.runtime, value, self); Visibility oldVis = binding.getFrame().getVisibility(); Frame lastFrame = pre(context, null, binding); try { return callback.call(context, self, realArg, block); } catch (JumpException.NextJump nj) { // A 'next' is like a local return from the block, ending this call or yield. return handleNextJump(context, nj, type); } finally { post(context, binding, oldVis, lastFrame); } }