[pypy-svn] r12212 - pypy/dist/pypy/annotation

pedronis at codespeak.net pedronis at codespeak.net
Thu May 12 13:34:14 CEST 2005


Author: pedronis
Date: Thu May 12 13:34:14 2005
New Revision: 12212

Modified:
   pypy/dist/pypy/annotation/binaryop.py
   pypy/dist/pypy/annotation/bookkeeper.py
Log:
* oops, last checkin had some non-sense lines in it...

* string with len==1 -> SomeChar



Modified: pypy/dist/pypy/annotation/binaryop.py
==============================================================================
--- pypy/dist/pypy/annotation/binaryop.py	(original)
+++ pypy/dist/pypy/annotation/binaryop.py	Thu May 12 13:34:14 2005
@@ -228,6 +228,10 @@
     def add((str1, str2)):
         return SomeString()
 
+class __extend__(pairtype(SomeChar, SomeChar)):
+
+    def union((chr1, chr2)):
+        return SomeChar()
 
 class __extend__(pairtype(SomeString, SomeObject)):
 

Modified: pypy/dist/pypy/annotation/bookkeeper.py
==============================================================================
--- pypy/dist/pypy/annotation/bookkeeper.py	(original)
+++ pypy/dist/pypy/annotation/bookkeeper.py	Thu May 12 13:34:14 2005
@@ -132,7 +132,10 @@
         elif tp is r_uint:
             result = SomeInteger(nonneg = True, unsigned = True)
         elif issubclass(tp, str): # py.lib uses annotated str subclasses
-            result = SomeString()
+            if len(x) == 1:
+                result = SomeChar()
+            else:
+                result = SomeString()
         elif tp is tuple:
             result = SomeTuple(items = [self.immutablevalue(e) for e in x])
         elif tp is float:
@@ -145,8 +148,6 @@
             values_s = [self.immutablevalue(e) for e in x.values()]
             result = SomeDict(DictDef(self, unionof(*keys_s),
                                             unionof(*values_s)))
-        elif isinstance(x, lltypes.LowLevelType):
-            result = ll_to_annotation(x._example())
         elif ishashable(x) and x in BUILTIN_ANALYZERS:
             result = SomeBuiltin(BUILTIN_ANALYZERS[x])
         elif callable(x) or isinstance(x, staticmethod): # XXX



More information about the Pypy-commit mailing list