Author: Ronan Lamy <[email protected]>
Branch: online-transforms
Changeset: r74410:1e1f2ee75e44
Date: 2014-11-07 18:51 +0000
http://bitbucket.org/pypy/pypy/changeset/1e1f2ee75e44/

Log:    store assignment value on the result of op.assign

diff --git a/rpython/annotator/unaryop.py b/rpython/annotator/unaryop.py
--- a/rpython/annotator/unaryop.py
+++ b/rpython/annotator/unaryop.py
@@ -9,7 +9,7 @@
 from rpython.annotator.model import (SomeObject, SomeInteger, SomeBool,
     SomeString, SomeChar, SomeList, SomeDict, SomeTuple, SomeImpossibleValue,
     SomeUnicodeCodePoint, SomeInstance, SomeBuiltin, SomeUnboundMethod, 
SomeBuiltinMethod,
-    SomeFloat, SomeIterator, SomePBC, SomeNone, SomeType, s_ImpossibleValue,
+    SomeFloat, SomeIterator, SomePBC, SomeNone, s_ImpossibleValue,
     s_Bool, s_None, unionof, add_knowntypedata,
     HarmlesslyBlocked, SomeWeakRef, SomeUnicodeString, SomeByteArray)
 from rpython.annotator.bookkeeper import getbookkeeper, immutablevalue
@@ -17,7 +17,6 @@
 from rpython.annotator.binaryop import _clone ## XXX where to put this?
 from rpython.annotator.model import AnnotatorError
 from rpython.annotator.argument import simple_args, complex_args
-from rpython.annotator.expression import V_Type
 
 UNARY_OPERATIONS = set([oper.opname for oper in op.__dict__.values()
                         if oper.dispatch == 1])
@@ -27,10 +26,6 @@
 def assign(annotator, v_obj):
     return annotator.annotation(v_obj)
 
[email protected]_transform(SomeObject)
-def type_SomeObject(annotator, v_arg):
-    return [op.assign(V_Type(v_arg))]
-
 @op.bool.register(SomeObject)
 def bool_SomeObject(annotator, obj):
     r = SomeBool()
diff --git a/rpython/flowspace/model.py b/rpython/flowspace/model.py
--- a/rpython/flowspace/model.py
+++ b/rpython/flowspace/model.py
@@ -250,7 +250,7 @@
 
 
 class Variable(object):
-    __slots__ = ["_name", "_nr", "annotation", "concretetype"]
+    __slots__ = ["_name", "_nr", "annotation", "concretetype", "equals"]
 
     dummyname = 'v'
     namesdict = {dummyname: (dummyname, 0)}
diff --git a/rpython/flowspace/operation.py b/rpython/flowspace/operation.py
--- a/rpython/flowspace/operation.py
+++ b/rpython/flowspace/operation.py
@@ -498,6 +498,18 @@
     def get_specialization(cls, s_seq, s_elem):
         return cls._dispatch(type(s_seq))
 
+class Type(SingleDispatchMixin, PureOperation):
+    opname = 'type'
+    arity = 1
+    canraise = []
+    pyfunc = staticmethod(new_style_type)
+
+    def transform(self, annotator):
+        from rpython.annotator.expression import V_Type
+        value = V_Type(self.args[0])
+        self.result.equals = value
+        return [op.assign(value)]
+
 
 class NewDict(HLOperation):
     opname = 'newdict'
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to