From: <pj...@us...> - 2008-08-09 22:02:43
|
Revision: 5126 http://jython.svn.sourceforge.net/jython/?rev=5126&view=rev Author: pjenvey Date: 2008-08-09 22:02:39 +0000 (Sat, 09 Aug 2008) Log Message: ----------- reprStack isn't exposed anywhere, simplify it as a Stack Modified Paths: -------------- branches/asm/src/org/python/core/ThreadState.java Modified: branches/asm/src/org/python/core/ThreadState.java =================================================================== --- branches/asm/src/org/python/core/ThreadState.java 2008-08-09 21:53:44 UTC (rev 5125) +++ branches/asm/src/org/python/core/ThreadState.java 2008-08-09 22:02:39 UTC (rev 5126) @@ -17,7 +17,7 @@ public boolean tracing; - public PyList reprStack = null; + private Stack reprStack = null; // public PyInstance initializingProxy = null; private Stack initializingProxies = null; @@ -68,30 +68,23 @@ } public boolean enterRepr(PyObject obj) { - // if (reprStack == null) System.err.println("reprStack: null"); - // else System.err.println("reprStack: "+reprStack.__len__()); - if (this.reprStack == null) { - this.reprStack = new PyList(new PyObject[] { obj }); - return true; + if (reprStack == null) { + reprStack = new Stack(); + } else if (reprStack.search(obj) > -1) { + return false; } - for (int i = this.reprStack.size() - 1; i >= 0; i--) { - if (obj == this.reprStack.pyget(i)) { - return false; - } - } - this.reprStack.append(obj); + reprStack.push(obj); return true; } public void exitRepr(PyObject obj) { - if (this.reprStack == null) { + if (reprStack == null) { return; } - - for (int i = this.reprStack.size() - 1; i >= 0; i--) { - if (this.reprStack.pyget(i) == obj) { - this.reprStack.delRange(i, this.reprStack.size(), 1); - } + int index; + if ((index = reprStack.search(obj)) > -1) { + int size = reprStack.size(); + reprStack.subList(size - index, size).clear(); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |