private static void addBackTraceElement( Ruby runtime, RubyArray backtrace, Frame frame, Frame previousFrame) { if (frame != previousFrame && // happens with native exceptions, should not filter those out frame.getLine() == previousFrame.getLine() && frame.getName() != null && frame.getName().equals(previousFrame.getName()) && frame.getFile().equals(previousFrame.getFile())) { return; } RubyString traceLine; if (previousFrame.getName() != null) { traceLine = RubyString.newString( runtime, frame.getFile() + ':' + (frame.getLine() + 1) + ":in `" + previousFrame.getName() + '\''); } else if (runtime.is1_9()) { // TODO: This probably isn't the best hack, but it works until we can have different // root frame setup for 1.9 easily. traceLine = RubyString.newString( runtime, frame.getFile() + ':' + (frame.getLine() + 1) + ":in `<main>'"); } else { traceLine = RubyString.newString(runtime, frame.getFile() + ':' + (frame.getLine() + 1)); } backtrace.append(traceLine); }
private String getMethodNameFromFrame(Frame current) { String methodName = current.getName(); if (current.getName() == null) { methodName = UNKNOWN_NAME; } return methodName; }
// XXX: Again, screwy evaling under previous frame's scope public void preExecuteUnder(RubyModule executeUnderClass, Block block) { Frame frame = getCurrentFrame(); pushRubyClass(executeUnderClass); DynamicScope scope = getCurrentScope(); StaticScope sScope = new BlockStaticScope(scope.getStaticScope()); sScope.setModule(executeUnderClass); pushScope(DynamicScope.newDynamicScope(sScope, scope)); pushCallFrame(frame.getKlazz(), frame.getName(), frame.getSelf(), block); getCurrentFrame().setVisibility(getPreviousFrame().getVisibility()); }
public void testUndoCreateSlot() { Slot slot = createSlot(); String name = slot.getName(); assertNotNull("name", name); Frame frame = getFrame(name); assertEquals("created", slot, frame); assertTrue("can undo", _frameStore.canUndo()); _frameStore.undo(); frame = getFrame(name); assertNull("undone", frame); _frameStore.redo(); frame = getFrame(name); assertEquals("recreated", frame.getName(), name); }
public void testUndocreateCls() { Cls cls = createCls(); String name = cls.getName(); assertNotNull("name", name); Frame frame = getFrame(name); assertEquals("created", cls, frame); assertTrue("can undo", _frameStore.canUndo()); _frameStore.undo(); frame = getFrame(name); assertNull("undone", frame); _frameStore.redo(); frame = getFrame(name); assertEquals("recreated", frame.getName(), name); }