[pypy-svn] rev 1498 - in pypy/trunk/src/pypy: objspace/flow translator/test

tomek at codespeak.net tomek at codespeak.net
Wed Oct 1 13:09:49 CEST 2003


Author: tomek
Date: Wed Oct  1 13:09:48 2003
New Revision: 1498

Modified:
   pypy/trunk/src/pypy/objspace/flow/wrapper.py
   pypy/trunk/src/pypy/translator/test/make_dot.py
Log:
I changed the representation of W_Variable and W_Constant to var(%s) and const(%s), and remove the framestate attribute from the graph, which makes it much smaller and thus much more human readable.




Modified: pypy/trunk/src/pypy/objspace/flow/wrapper.py
==============================================================================
--- pypy/trunk/src/pypy/objspace/flow/wrapper.py	(original)
+++ pypy/trunk/src/pypy/objspace/flow/wrapper.py	Wed Oct  1 13:09:48 2003
@@ -26,9 +26,12 @@
 
     def __repr__(self):
         s = self.argsrepr()
+        name = getattr(self, "symname", "")
+        if not name:
+            name = self.__class__.__name__
         if len(s) > 100:
             s = s[:25] + "..." + s[-25:]
-        return "%s(%s)" % (self.__class__.__name__, s)
+        return "%s(%s)" % (name, s)
 
     def argsrepr(self):
         return ""
@@ -47,6 +50,7 @@
 
 class W_Variable(W_Object, Variable):
     counter = 0
+    symname = "var"
 
     def __init__(self):
         Variable.__init__(self, 'v%d' % W_Variable.counter)
@@ -60,6 +64,7 @@
 class W_Constant(W_Object, Constant):
     """A specific constant value."""
 
+    symname = "const"
     def __init__(self, value):
         Constant.__init__(self, value)
 

Modified: pypy/trunk/src/pypy/translator/test/make_dot.py
==============================================================================
--- pypy/trunk/src/pypy/translator/test/make_dot.py	(original)
+++ pypy/trunk/src/pypy/translator/test/make_dot.py	Wed Oct  1 13:09:48 2003
@@ -169,6 +169,9 @@
         if node:
             self.nodes[obj] = node
             for name, attr in obj.__dict__.items():
+                ##XXX it makes the graph not very readeable
+                if name == "framestate":
+                    continue
                 trynode = self.traverse(attr, name)
                 if trynode:
                     node.addedge(trynode, name)


More information about the Pypy-commit mailing list