[pypy-commit] pypy default: move BoolRepr to rpython.rtyper.rbool

rlamy noreply at buildbot.pypy.org
Tue May 13 22:07:55 CEST 2014


Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: 
Changeset: r71495:3365b7b9ccf6
Date: 2014-05-13 16:51 +0100
http://bitbucket.org/pypy/pypy/changeset/3365b7b9ccf6/

Log:	move BoolRepr to rpython.rtyper.rbool

diff --git a/rpython/rtyper/rbool.py b/rpython/rtyper/rbool.py
--- a/rpython/rtyper/rbool.py
+++ b/rpython/rtyper/rbool.py
@@ -1,21 +1,16 @@
 from rpython.annotator import model as annmodel
 from rpython.rtyper.error import TyperError
 from rpython.rtyper.lltypesystem.lltype import Signed, Unsigned, Bool, Float
-from rpython.rtyper.rmodel import IntegerRepr, BoolRepr, log
+from rpython.rtyper.rmodel import IntegerRepr, log
 from rpython.tool.pairtype import pairtype
 
 
-class __extend__(annmodel.SomeBool):
-    def rtyper_makerepr(self, rtyper):
-        return bool_repr
-
-    def rtyper_makekey(self):
-        return self.__class__,
-
-bool_repr = BoolRepr()
-
-
-class __extend__(BoolRepr):
+class BoolRepr(IntegerRepr):
+    lowleveltype = Bool
+    # NB. no 'opprefix' here.  Use 'as_int' systematically.
+    def __init__(self):
+        from rpython.rtyper.rint import signed_repr
+        self.as_int = signed_repr
 
     def convert_const(self, value):
         if not isinstance(value, bool):
@@ -23,7 +18,7 @@
         return value
 
     def rtype_bool(_, hop):
-        vlist = hop.inputargs(Bool)
+        vlist = hop.inputargs(bool_repr)
         return vlist[0]
 
     def rtype_int(_, hop):
@@ -36,6 +31,16 @@
         hop.exception_cannot_occur()
         return vlist[0]
 
+bool_repr = BoolRepr()
+
+
+class __extend__(annmodel.SomeBool):
+    def rtyper_makerepr(self, rtyper):
+        return bool_repr
+
+    def rtyper_makekey(self):
+        return self.__class__,
+
 #
 # _________________________ Conversions _________________________
 
diff --git a/rpython/rtyper/rfloat.py b/rpython/rtyper/rfloat.py
--- a/rpython/rtyper/rfloat.py
+++ b/rpython/rtyper/rfloat.py
@@ -7,7 +7,8 @@
 from rpython.rtyper.error import TyperError
 from rpython.rtyper.lltypesystem.lltype import (Signed, Unsigned,
     SignedLongLong, UnsignedLongLong, Bool, Float)
-from rpython.rtyper.rmodel import FloatRepr, IntegerRepr, BoolRepr, log
+from rpython.rtyper.rmodel import FloatRepr, IntegerRepr, log
+from rpython.rtyper.rbool import BoolRepr
 from rpython.rtyper.rstr import AbstractStringRepr
 from rpython.tool.pairtype import pairtype
 
diff --git a/rpython/rtyper/rmodel.py b/rpython/rtyper/rmodel.py
--- a/rpython/rtyper/rmodel.py
+++ b/rpython/rtyper/rmodel.py
@@ -342,13 +342,6 @@
 
     opprefix = property(_get_opprefix)
 
-class BoolRepr(IntegerRepr):
-    lowleveltype = Bool
-    # NB. no 'opprefix' here.  Use 'as_int' systematically.
-    def __init__(self):
-        from rpython.rtyper.rint import signed_repr
-        self.as_int = signed_repr
-
 class VoidRepr(Repr):
     lowleveltype = Void
     def get_ll_eq_function(self): return None


More information about the pypy-commit mailing list