[pypy-svn] r26220 - pypy/dist/pypy/translator/cl

yusei at codespeak.net yusei at codespeak.net
Mon Apr 24 06:05:31 CEST 2006


Author: yusei
Date: Mon Apr 24 06:05:28 2006
New Revision: 26220

Modified:
   pypy/dist/pypy/translator/cl/gencl.py
Log:
(yusei, sanxiyn, nik)
Implemented oogetfield and oosetfield.


Modified: pypy/dist/pypy/translator/cl/gencl.py
==============================================================================
--- pypy/dist/pypy/translator/cl/gencl.py	(original)
+++ pypy/dist/pypy/translator/cl/gencl.py	Mon Apr 24 06:05:28 2006
@@ -112,10 +112,21 @@
         print "(setq %s (make-%s))" % (target, cls._name)
 
     def op_oogetfield(self):
-        print "; oogetfield called"
+        target = self.str(self.result)
+        clsname = self.args[0].concretetype._name
+        fieldname = self.args[1].value
+        obj = self.str(self.args[0])
+        print "(setq %s (%s-%s %s))" % (target, clsname, fieldname, obj)
 
     def op_oosetfield(self):
-        print "; oosetfield called"
+        target = self.str(self.result)
+        clsname = self.args[0].concretetype._name
+        fieldname = self.args[1].value
+        if fieldname == "meta": # XXX
+            return
+        obj = self.str(self.args[0])
+        fieldvalue = self.str(self.args[2])
+        print "(setf (%s-%s %s) %s)" % (clsname, fieldname, obj, fieldvalue)
 
     def op_newtuple(self):
         s = self.str



More information about the Pypy-commit mailing list