Exemplo n.º 1
0
  @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);
    }
  }
Exemplo n.º 2
0
  // 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);
    }
  }
Exemplo n.º 3
0
 public int getLine() {
   return callback.getLine();
 }
Exemplo n.º 4
0
 public String getFile() {
   return callback.getFile();
 }