public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule clazz, String name, IRubyObject[] args, Block block) { try { callConfig.pre(context, self, clazz, name, block, null); assert args != null; Ruby runtime = context.runtime; boolean isTrace = runtime.hasEventHooks(); if (isTrace) { runtime.callEventHooks(context, RubyEvent.C_CALL, context.getFile(), context.getLine(), name, getImplementationClass()); } try { return callback.execute(self, args, block); } catch (JumpException.ReturnJump rj) { if (rj.getTarget() == context.getFrameJumpTarget()) return (IRubyObject)rj.getValue(); throw rj; } finally { if (isTrace) { runtime.callEventHooks(context, RubyEvent.C_RETURN, context.getFile(), context.getLine(), name, getImplementationClass()); } } } finally { callConfig.post(context); } }
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule clazz, String name, IRubyObject[] args, Block block) { try { callConfig.pre(context, self, clazz, name, block, null); assert args != null; Ruby runtime = context.runtime; boolean isTrace = runtime.hasEventHooks(); if (isTrace) { runtime.callEventHooks(context, RubyEvent.C_CALL, context.getFile(), context.getLine(), name, getImplementationClass()); } try { return callback.execute(self, args, block); } catch (JumpException.ReturnJump rj) { if (rj.getTarget() == context.getFrameJumpTarget()) return (IRubyObject)rj.getValue(); throw rj; } finally { if (isTrace) { runtime.callEventHooks(context, RubyEvent.C_RETURN, context.getFile(), context.getLine(), name, getImplementationClass()); } } } finally { callConfig.post(context); } }
private IRubyObject handleReturnJump(ThreadContext context, JumpException.ReturnJump rj, int jumpTarget) { int target = rj.getTarget(); // lambda always just returns the value if (target == jumpTarget && isLambda()) return (IRubyObject) rj.getValue(); // returns can't propagate out of threads. rethrow to let thread handle it if (isThread()) throw rj; // If the block-receiving method is not still active and the original // enclosing frame is no longer on the stack, it's a bad return. // FIXME: this is not very efficient for cases where it won't error if (target == jumpTarget && !context.isJumpTargetAlive(target, 0)) { throw context.runtime.newLocalJumpError(RubyLocalJumpError.Reason.RETURN, (IRubyObject) rj.getValue(), "unexpected return"); } // otherwise, let it propagate throw rj; }
private IRubyObject handleReturnJump(ThreadContext context, JumpException.ReturnJump rj, int jumpTarget) { int target = rj.getTarget(); // lambda always just returns the value if (target == jumpTarget && isLambda()) return (IRubyObject) rj.getValue(); // returns can't propagate out of threads. rethrow to let thread handle it if (isThread()) throw rj; // If the block-receiving method is not still active and the original // enclosing frame is no longer on the stack, it's a bad return. // FIXME: this is not very efficient for cases where it won't error if (target == jumpTarget && !context.isJumpTargetAlive(target, 0)) { throw context.runtime.newLocalJumpError(RubyLocalJumpError.Reason.RETURN, (IRubyObject) rj.getValue(), "unexpected return"); } // otherwise, let it propagate throw rj; }
protected IRubyObject handleReturn(ThreadContext context, JumpException.ReturnJump rj, int callNumber) { if (rj.getTarget() == callNumber) { return (IRubyObject) rj.getValue(); } throw rj; }
public static IRubyObject handleReturn(JumpException.ReturnJump rj, ThreadContext context) { if (rj.getTarget() == context.getFrameJumpTarget()) { return (IRubyObject)rj.getValue(); } throw rj; }
protected IRubyObject handleReturn(ThreadContext context, JumpException.ReturnJump rj, int callNumber) { if (rj.getTarget() == callNumber) { return (IRubyObject) rj.getValue(); } throw rj; }
public static IRubyObject handleReturn(JumpException.ReturnJump rj, ThreadContext context) { if (rj.getTarget() == context.getFrameJumpTarget()) { return (IRubyObject)rj.getValue(); } throw rj; }