[pypy-svn] r26484 - in pypy/dist/pypy/translator/cl: . test

sanxiyn at codespeak.net sanxiyn at codespeak.net
Fri Apr 28 05:13:03 CEST 2006


Author: sanxiyn
Date: Fri Apr 28 05:12:59 2006
New Revision: 26484

Modified:
   pypy/dist/pypy/translator/cl/gencl.py
   pypy/dist/pypy/translator/cl/test/test_oo.py
Log:
(dialtone, sanxiyn)
Generate all methods of classes up front, not only those which are
"apparently" called. Pass a test.


Modified: pypy/dist/pypy/translator/cl/gencl.py
==============================================================================
--- pypy/dist/pypy/translator/cl/gencl.py	(original)
+++ pypy/dist/pypy/translator/cl/gencl.py	Fri Apr 28 05:12:59 2006
@@ -128,9 +128,6 @@
             code = getattr(impl, method)(*args)
             yield "(setf %s %s)" % (clrepr(result, True), clrepr(code, True))
         elif isinstance(cls, Instance):
-            methodobj = cls._methods[method]
-            methodobj._method_name = method # XXX
-            self.gen.pendinggraphs.append(methodobj)
             name = clrepr(method, symbol=True)
             selfvar = clrepr(receiver)
             args = map(self.gen.check_declaration, args)
@@ -226,6 +223,10 @@
             supername = clrepr(cls._superclass._name, symbol=True)
             class_declaration = "(defclass %s (%s) (%s))" % (name, supername, field_declaration)
         self.declarations[name] = class_declaration
+        for method in cls._methods:
+            methodobj = cls._methods[method]
+            methodobj._method_name = method
+            self.pendinggraphs.append(methodobj)
 
     def declare_constant_instance(self, const):
         # const.concretetype is Instance

Modified: pypy/dist/pypy/translator/cl/test/test_oo.py
==============================================================================
--- pypy/dist/pypy/translator/cl/test/test_oo.py	(original)
+++ pypy/dist/pypy/translator/cl/test/test_oo.py	Fri Apr 28 05:12:59 2006
@@ -115,7 +115,6 @@
     assert cl_runtime_new(False) == 0
 
 def test_instance():
-    py.test.skip("TODO")
     class Foo:
         value = 0
     class Bar(Foo):



More information about the Pypy-commit mailing list