private void popFrameReal(Frame oldFrame) { int index = frameIndex; Frame frame = frameStack[index]; frameStack[index] = oldFrame; frameIndex = index - 1; setFileAndLine(frame); }
private Frame pushFrameForEval(Binding binding) { Frame lastFrame = getNextFrame(); Frame f = pushFrame(binding.getFrame()); setFileAndLine(binding.getFile(), binding.getLine()); f.setVisibility(binding.getVisibility()); return lastFrame; }
@Override public IRubyObject interpret( Ruby runtime, ThreadContext context, IRubyObject self, Block aBlock) { Block block = SharedScopeBlock.newInterpretedSharedScopeClosure( context, this, context.getCurrentScope(), self); try { while (true) { try { String savedFile = context.getFile(); int savedLine = context.getLine(); IRubyObject recv = null; try { recv = iterNode.interpret(runtime, context, self, aBlock); } finally { context.setFileAndLine(savedFile, savedLine); } return callAdapter.call(context, self, recv, block); } catch (JumpException.RetryJump rj) { // do nothing, allow loop to retry } } } catch (JumpException.BreakJump bj) { return (IRubyObject) bj.getValue(); } }
private Frame pushFrameForBlock(Binding binding) { Frame lastFrame = getNextFrame(); Frame f = pushFrame(binding.getFrame()); // set the binding's frame's "previous" file and line to current, so // trace will show who called the block f.setFileAndLine(file, line); setFileAndLine(binding.getFile(), binding.getLine()); f.setVisibility(binding.getVisibility()); return lastFrame; }
public static IRubyObject[] setupArgs( Ruby runtime, ThreadContext context, Node node, IRubyObject self, Block aBlock) { if (node == null) return IRubyObject.NULL_ARRAY; if (node instanceof ArrayNode) { ArrayNode argsArrayNode = (ArrayNode) node; String savedFile = context.getFile(); int savedLine = context.getLine(); int size = argsArrayNode.size(); IRubyObject[] argsArray = new IRubyObject[size]; for (int i = 0; i < size; i++) { argsArray[i] = argsArrayNode.get(i).interpret(runtime, context, self, aBlock); } context.setFileAndLine(savedFile, savedLine); return argsArray; } return ArgsUtil.convertToJavaArray(node.interpret(runtime, context, self, aBlock)); }
private void popFrame() { Frame frame = frameStack[frameIndex--]; setFileAndLine(frame); frame.clear(); }
public void preRunThread(Frame currentFrame) { setFileAndLine(currentFrame); pushFrame(currentFrame); }