org.jruby.Ruby.newLocalJumpError()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(8.3k)|赞(0)|评价(0)|浏览(139)

本文整理了Java中org.jruby.Ruby.newLocalJumpError方法的一些代码示例,展示了Ruby.newLocalJumpError的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ruby.newLocalJumpError方法的具体详情如下:
包路径:org.jruby.Ruby
类名称:Ruby
方法名:newLocalJumpError

Ruby.newLocalJumpError介绍

暂无

代码示例

代码示例来源:origin: org.jruby/jruby-complete

@Override
public IRubyObject yieldSpecific(ThreadContext context, Block block, IRubyObject arg0) {
  throw context.runtime.newLocalJumpError(RubyLocalJumpError.Reason.NOREASON, context.nil, "yield called out of block");
}
@Override

代码示例来源:origin: org.jruby/jruby-complete

@Override
public IRubyObject yieldSpecific(ThreadContext context, Block block, IRubyObject arg0, IRubyObject arg1) {
  throw context.runtime.newLocalJumpError(RubyLocalJumpError.Reason.NOREASON, context.nil, "yield called out of block");
}
@Override

代码示例来源:origin: org.jruby/jruby-core

@Override
public IRubyObject yieldSpecific(ThreadContext context, Block block, IRubyObject arg0) {
  throw context.runtime.newLocalJumpError(RubyLocalJumpError.Reason.NOREASON, context.nil, "yield called out of block");
}
@Override

代码示例来源:origin: org.jruby/jruby-core

@Override
public IRubyObject yieldSpecific(ThreadContext context, Block block, IRubyObject arg0, IRubyObject arg1) {
  throw context.runtime.newLocalJumpError(RubyLocalJumpError.Reason.NOREASON, context.nil, "yield called out of block");
}
@Override

代码示例来源:origin: org.jruby/jruby-core

@Override
public IRubyObject yieldSpecific(ThreadContext context, Block block) {
  throw context.runtime.newLocalJumpError(RubyLocalJumpError.Reason.NOREASON, context.nil, "yield called out of block");
}
@Override

代码示例来源:origin: org.jruby/jruby-complete

@Override
public IRubyObject yieldSpecific(ThreadContext context, Block block) {
  throw context.runtime.newLocalJumpError(RubyLocalJumpError.Reason.NOREASON, context.nil, "yield called out of block");
}
@Override

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

public RuntimeException getException(Ruby runtime) {
  if (this == NEXT_LocalJumpError) return runtime.newLocalJumpError(RubyLocalJumpError.Reason.NEXT, null, "unexpected next");
  else if (this == BREAK_LocalJumpError) return runtime.newLocalJumpError(RubyLocalJumpError.Reason.BREAK, null, "unexpected break");
  else if (this == RETURN_LocalJumpError) return runtime.newLocalJumpError(RubyLocalJumpError.Reason.RETURN, null, "unexpected return");
  else if (this == REDO_LocalJumpError) return runtime.newLocalJumpError(RubyLocalJumpError.Reason.REDO, null, "unexpected redo");
  else if (this == RETRY_LocalJumpError) return runtime.newLocalJumpError(RubyLocalJumpError.Reason.RETRY, null, "retry outside of rescue not supported");
  else throw new RuntimeException("Unhandled case in operands/IRException.java");
}

代码示例来源:origin: org.jruby/jruby-complete

@Override
public IRubyObject call(ThreadContext context, Block block) {
  throw context.runtime.newLocalJumpError(RubyLocalJumpError.Reason.NOREASON, RubyArray.newEmptyArray(context.runtime), "yield called out of block");
}
@Override

代码示例来源:origin: org.jruby/jruby-complete

@Override
public IRubyObject call(ThreadContext context, Block block, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2) {
  throw context.runtime.newLocalJumpError(RubyLocalJumpError.Reason.NOREASON, RubyArray.newArray(context.runtime, arg0, arg1, arg2), "yield called out of block");
}
@Override

代码示例来源:origin: org.jruby/jruby-core

@Override
public IRubyObject call(ThreadContext context, Block block) {
  throw context.runtime.newLocalJumpError(RubyLocalJumpError.Reason.NOREASON, RubyArray.newEmptyArray(context.runtime), "yield called out of block");
}
@Override

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

@Override
public IRubyObject yieldSpecific(ThreadContext context, IRubyObject arg0, IRubyObject arg1, Binding binding, Type type) {
  throw context.runtime.newLocalJumpError(RubyLocalJumpError.Reason.NOREASON, context.runtime.getNil(), "yield called out of block");
}
@Override

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

@Override
public IRubyObject call(ThreadContext context, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, Binding binding, Type type) {
  throw context.runtime.newLocalJumpError(RubyLocalJumpError.Reason.NOREASON, context.runtime.newArrayNoCopy(new IRubyObject[]{arg0, arg1, arg2}), "yield called out of block");
}
@Override

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

@Override
public IRubyObject yieldSpecific(ThreadContext context, IRubyObject arg0, IRubyObject arg1, Binding binding, Type type) {
  throw context.runtime.newLocalJumpError(RubyLocalJumpError.Reason.NOREASON, context.runtime.getNil(), "yield called out of block");
}
@Override

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

@Override
public IRubyObject call(ThreadContext context, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, Binding binding, Type type) {
  throw context.runtime.newLocalJumpError(RubyLocalJumpError.Reason.NOREASON, context.runtime.newArrayNoCopy(new IRubyObject[]{arg0, arg1, arg2}), "yield called out of block");
}
@Override

代码示例来源:origin: org.jruby/jruby-core

@Override
public IRubyObject call(ThreadContext context, Block block, IRubyObject arg0) {
  throw context.runtime.newLocalJumpError(RubyLocalJumpError.Reason.NOREASON, RubyArray.newArray(context.runtime, arg0), "yield called out of block");
}
@Override

代码示例来源:origin: org.jruby/jruby-complete

@Override
public IRubyObject call(ThreadContext context, Block block, IRubyObject arg0, IRubyObject arg1) {
  throw context.runtime.newLocalJumpError(RubyLocalJumpError.Reason.NOREASON, RubyArray.newArray(context.runtime, arg0, arg1), "yield called out of block");
}
@Override

代码示例来源:origin: org.jruby/jruby-core

public RuntimeException getException(Ruby runtime) {
  switch (getType()) {
    case NEXT: return runtime.newLocalJumpError(getType(), null, "unexpected next");
    case BREAK: return runtime.newLocalJumpError(getType(), null, "unexpected break");
    case RETURN: return runtime.newLocalJumpError(getType(), null, "unexpected return");
    case REDO: return runtime.newLocalJumpError(getType(), null, "unexpected redo");
    case RETRY: return runtime.newLocalJumpError(getType(), null, "retry outside of rescue not supported");
  }
  throw new RuntimeException("Unhandled case in operands/IRException.java");
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

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();
      
      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");
  }
  
  throw bj;
}

代码示例来源:origin: org.jruby/jruby-complete

public static IRubyObject initiateBreak(ThreadContext context, DynamicScope dynScope, IRubyObject breakValue, Block block) throws RuntimeException {
  // Wrap the return value in an exception object and push it through the break exception
  // paths so that ensures are run, frames/scopes are popped from runtime stacks, etc.
  if (inLambda(block.type)) throw new IRWrappedLambdaReturnValue(breakValue);
  IRScopeType scopeType = ensureScopeIsClosure(context, dynScope);
  DynamicScope parentScope = dynScope.getParentScope();
  if (block.isEscaped()) {
    throw context.runtime.newLocalJumpError(RubyLocalJumpError.Reason.BREAK, breakValue, "unexpected break");
  }
  // Raise a break jump so we can bubble back down the stack to the appropriate place to break from.
  throw IRBreakJump.create(parentScope, breakValue, scopeType.isEval()); // weirdly evals are impld as closures...yes yes.
}

代码示例来源:origin: org.jruby/jruby-core

public static IRubyObject initiateBreak(ThreadContext context, DynamicScope dynScope, IRubyObject breakValue, Block block) throws RuntimeException {
  // Wrap the return value in an exception object and push it through the break exception
  // paths so that ensures are run, frames/scopes are popped from runtime stacks, etc.
  if (inLambda(block.type)) throw new IRWrappedLambdaReturnValue(breakValue);
  IRScopeType scopeType = ensureScopeIsClosure(context, dynScope);
  DynamicScope parentScope = dynScope.getParentScope();
  if (block.isEscaped()) {
    throw context.runtime.newLocalJumpError(RubyLocalJumpError.Reason.BREAK, breakValue, "unexpected break");
  }
  // Raise a break jump so we can bubble back down the stack to the appropriate place to break from.
  throw IRBreakJump.create(parentScope, breakValue, scopeType.isEval()); // weirdly evals are impld as closures...yes yes.
}

相关文章

Ruby类方法