[pypy-svn] r25568 - pypy/dist/pypy/rpython/ootypesystem

antocuni at codespeak.net antocuni at codespeak.net
Sat Apr 8 18:56:55 CEST 2006


Author: antocuni
Date: Sat Apr  8 18:56:50 2006
New Revision: 25568

Modified:
   pypy/dist/pypy/rpython/ootypesystem/ootype.py
Log:
Added the _lookup_field method to _instance class. The method body is
similar to _lookup.



Modified: pypy/dist/pypy/rpython/ootypesystem/ootype.py
==============================================================================
--- pypy/dist/pypy/rpython/ootypesystem/ootype.py	(original)
+++ pypy/dist/pypy/rpython/ootypesystem/ootype.py	Sat Apr  8 18:56:50 2006
@@ -132,6 +132,17 @@
 
     _check_field = _field_type
 
+    def _lookup_field(self, name):
+        field = self._fields.get(name)
+
+        if field is None and self._superclass is not None:
+            return self._superclass._lookup_field(name)
+
+        try:
+            return self, field[0]
+        except TypeError:
+            return self, None
+
     def _lookup(self, meth_name):
         meth = self._methods.get(meth_name)
 
@@ -455,6 +466,9 @@
        callb, checked_args = self._checkargs(args)
        return callb(*checked_args)
 
+   def __repr__(self):
+       return 'sm %s' % self._name
+
 class _meth(_callable):
    
     def __init__(self, METHOD, **attrs):



More information about the Pypy-commit mailing list