コード例 #1
0
ファイル: CompiledBlock.java プロジェクト: ratnikov/jruby
  @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);
    }
  }
コード例 #2
0
ファイル: CompiledBlock.java プロジェクト: ratnikov/jruby
  // 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);
    }
  }
コード例 #3
0
ファイル: CompiledBlock.java プロジェクト: ratnikov/jruby
 public int getLine() {
   return callback.getLine();
 }
コード例 #4
0
ファイル: CompiledBlock.java プロジェクト: ratnikov/jruby
 public String getFile() {
   return callback.getFile();
 }