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

sanxiyn at codespeak.net sanxiyn at codespeak.net
Sun Apr 30 16:46:59 CEST 2006


Author: sanxiyn
Date: Sun Apr 30 16:46:56 2006
New Revision: 26603

Modified:
   pypy/dist/pypy/translator/cl/opformatter.py
Log:
Cleanup op_new


Modified: pypy/dist/pypy/translator/cl/opformatter.py
==============================================================================
--- pypy/dist/pypy/translator/cl/opformatter.py	(original)
+++ pypy/dist/pypy/translator/cl/opformatter.py	Sun Apr 30 16:46:56 2006
@@ -69,24 +69,22 @@
                                      clrepr(fun, True),
                                      clrepr(args, True))
 
-    def op_new(self, result, clsname):
+    def op_new(self, result, _):
         cls = self.args[0].value
         if isinstance(cls, List):
-            yield "(setf %s (make-array 0 :adjustable t))" % (clrepr(result, True),)
+            yield "(setf %s (make-array 0 :adjustable t))" % (result,)
         elif isinstance(cls, Record):
             clsname = self.gen.declare_struct(cls)
-            yield "(setf %s (make-%s))" % (clrepr(result, True),
-                                           clrepr(clsname, True))
+            yield "(setf %s (make-%s))" % (result, clsname)
         elif isinstance(cls, Instance):
-            clsname = clrepr(cls)
             if self.gen.is_exception_instance(cls):
-                self.gen.declare_exception(cls)
-                yield "(setf %s (make-condition %s))" % (result, clsname)
+                clsname = self.gen.declare_exception(cls)
+                yield "(setf %s (make-condition '%s))" % (result, clsname)
             else:
-                self.gen.declare_class(cls)
-                yield "(setf %s (make-instance %s))" % (result, clsname)
+                clsname = self.gen.declare_class(cls)
+                yield "(setf %s (make-instance '%s))" % (result, clsname)
         else:
-            raise NotImplementedError()
+            raise NotImplementedError("op_new on %s" % (cls,))
 
     def op_runtimenew(self, result, arg):
         yield "(setf %s (make-instance %s))" % (clrepr(result, True),



More information about the Pypy-commit mailing list