[pypy-svn] r47937 - pypy/dist/pypy/lang/smalltalk

arigo at codespeak.net arigo at codespeak.net
Thu Oct 25 16:25:52 CEST 2007


Author: arigo
Date: Thu Oct 25 16:25:52 2007
New Revision: 47937

Modified:
   pypy/dist/pypy/lang/smalltalk/shadow.py
Log:
Read s_superclass and s_metaclass.  That's all untested code - naughty us.


Modified: pypy/dist/pypy/lang/smalltalk/shadow.py
==============================================================================
--- pypy/dist/pypy/lang/smalltalk/shadow.py	(original)
+++ pypy/dist/pypy/lang/smalltalk/shadow.py	Thu Oct 25 16:25:52 2007
@@ -47,6 +47,8 @@
 
     def update_shadow(self):
         "Update the ClassShadow with data from the w_self class."
+        from pypy.lang.smalltalk import objtable
+
         w_self = self.w_self
         # read and painfully decode the format
         classformat = unwrap_int(w_self.fetch(constants.CLASS_FORMAT_INDEX))
@@ -82,14 +84,21 @@
             self.instance_kind = COMPILED_METHOD
         else:
             raise ClassShadowError("unknown format %d" % (format,))
-        # XXX read s_superclass
-        # XXX read s_metaclass
         # XXX read the methoddict
+        # ...
+
+        # for the rest, we need to reset invalid to False already so
+        # that cycles in the superclass and/or metaclass chains don't
+        # cause infinite recursion
         self.invalid = False
-        if self.s_superclass is not None:
-            self.s_superclass.check_for_updates()
-        if self.s_metaclass is not None:
-            self.s_metaclass.check_for_updates()
+        # read s_superclass
+        w_superclass = w_self.fetch(constants.CLASS_SUPERCLASS_INDEX)
+        if w_superclass is objtable.w_nil:
+            self.s_superclass = None
+        else:
+            self.s_superclass = w_superclass.as_class_get_shadow()
+        # read s_metaclass
+        self.s_metaclass = w_self.shadow_of_my_class()
 
     def new(self, extrasize=0):
         w_cls = self.w_self



More information about the Pypy-commit mailing list