[pypy-svn] r33555 - in pypy/dist/pypy: annotation rpython/ootypesystem

antocuni at codespeak.net antocuni at codespeak.net
Mon Oct 23 14:26:56 CEST 2006


Author: antocuni
Date: Mon Oct 23 14:26:56 2006
New Revision: 33555

Modified:
   pypy/dist/pypy/annotation/unaryop.py
   pypy/dist/pypy/rpython/ootypesystem/ootype.py
Log:
Move logic from annotator to ootype, so that can be reused by backends
too.



Modified: pypy/dist/pypy/annotation/unaryop.py
==============================================================================
--- pypy/dist/pypy/annotation/unaryop.py	(original)
+++ pypy/dist/pypy/annotation/unaryop.py	Mon Oct 23 14:26:56 2006
@@ -706,9 +706,7 @@
         inst = m.ootype._example()
         _, meth = m.ootype._lookup(m.name)
         if isinstance(meth, ootype._overloaded_meth):
-            ARGS = tuple([meth._annotation_to_lltype(arg_s) for arg_s in args_s])
-            METH = meth._resolve_overloading(ARGS)._TYPE
-            return meth._lltype_to_annotation(METH.RESULT)
+            return meth._annotate_overloading(args_s)
         else:
             METH = ootype.typeOf(meth)
             return lltype_to_annotation(METH.RESULT)

Modified: pypy/dist/pypy/rpython/ootypesystem/ootype.py
==============================================================================
--- pypy/dist/pypy/rpython/ootypesystem/ootype.py	(original)
+++ pypy/dist/pypy/rpython/ootypesystem/ootype.py	Mon Oct 23 14:26:56 2006
@@ -898,6 +898,11 @@
                 return meth
         raise TypeError, 'No suitable overloading found for method'
 
+    def _annotate_overloading(self, args_s):
+        ARGS = tuple([self._annotation_to_lltype(arg_s) for arg_s in args_s])
+        METH = self._resolve_overloading(ARGS)._TYPE
+        return self._lltype_to_annotation(METH.RESULT)
+
     def _annotation_to_lltype(self, ann):
         from pypy.annotation import model as annmodel
         if isinstance(ann, annmodel.SomeChar):



More information about the Pypy-commit mailing list