return ASTInterpreter.INTERPRET_ROOT(this, context, node, context.getFrameSelf(), Block.NULL_BLOCK); } catch (JumpException.ReturnJump rj) { throw newLocalJumpError(RubyLocalJumpError.Reason.RETURN, (IRubyObject)rj.getValue(), "unexpected return"); } catch (JumpException.BreakJump bj) { throw newLocalJumpError(RubyLocalJumpError.Reason.BREAK, (IRubyObject)bj.getValue(), "unexpected break");
return ASTInterpreter.INTERPRET_ROOT(this, context, node, context.getFrameSelf(), Block.NULL_BLOCK); } catch (JumpException.ReturnJump rj) { throw newLocalJumpError(RubyLocalJumpError.Reason.RETURN, (IRubyObject)rj.getValue(), "unexpected return"); } catch (JumpException.BreakJump bj) { throw newLocalJumpError(RubyLocalJumpError.Reason.BREAK, (IRubyObject)bj.getValue(), "unexpected break");
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 IRubyObject runInterpreter(ThreadContext context, Node rootNode, IRubyObject self) { assert rootNode != null : "scriptNode is not null"; try { if (getInstanceConfig().getCompileMode() == CompileMode.OFFIR) { return Interpreter.interpret(this, rootNode, self); } else { return ASTInterpreter.INTERPRET_ROOT(this, context, rootNode, getTopSelf(), Block.NULL_BLOCK); } } catch (JumpException.ReturnJump rj) { return (IRubyObject) rj.getValue(); } }
/** * This is used for the "gets" loop, and we bypass 'load' to use an * already-prepared, already-pushed scope for the script body. */ public IRubyObject runScriptBody(Script script) { ThreadContext context = getCurrentContext(); try { return script.__file__(context, getTopSelf(), Block.NULL_BLOCK); } catch (JumpException.ReturnJump rj) { return (IRubyObject) rj.getValue(); } }
/** * This is used for the "gets" loop, and we bypass 'load' to use an * already-prepared, already-pushed scope for the script body. */ public IRubyObject runScriptBody(Script script) { ThreadContext context = getCurrentContext(); try { return script.__file__(context, getTopSelf(), Block.NULL_BLOCK); } catch (JumpException.ReturnJump rj) { return (IRubyObject) rj.getValue(); } }
public static IRubyObject handleReturn(JumpException.ReturnJump rj, ThreadContext context) { if (rj.getTarget() == context.getFrameJumpTarget()) { return (IRubyObject)rj.getValue(); } throw rj; }
public IRubyObject runScript(Script script, boolean wrap) { ThreadContext context = getCurrentContext(); try { return script.load(context, getTopSelf(), wrap); } catch (JumpException.ReturnJump rj) { return (IRubyObject) rj.getValue(); } }
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; }
public IRubyObject runScript(Script script, boolean wrap) { ThreadContext context = getCurrentContext(); try { return script.load(context, getTopSelf(), wrap); } catch (JumpException.ReturnJump rj) { return (IRubyObject) rj.getValue(); } }
public IRubyObject runInterpreter(ThreadContext context, Node rootNode, IRubyObject self) { assert rootNode != null : "scriptNode is not null"; try { if (getInstanceConfig().getCompileMode() == CompileMode.OFFIR) { return Interpreter.interpret(this, rootNode, self); } else { return ASTInterpreter.INTERPRET_ROOT(this, context, rootNode, getTopSelf(), Block.NULL_BLOCK); } } catch (JumpException.ReturnJump rj) { return (IRubyObject) rj.getValue(); } }