Author: Ronan Lamy <[email protected]>
Branch: reflowing
Changeset: r88660:01e41e1ab1a1
Date: 2016-11-24 20:49 +0000
http://bitbucket.org/pypy/pypy/changeset/01e41e1ab1a1/

Log:    Create annotator.get_op()

diff --git a/rpython/annotator/annrpython.py b/rpython/annotator/annrpython.py
--- a/rpython/annotator/annrpython.py
+++ b/rpython/annotator/annrpython.py
@@ -280,9 +280,12 @@
         tag = parent_block, parent_index
         self.translator.update_call_graph(parent_graph, graph, tag)
 
+    def get_op(self, position_key):
+        _, block, index = position_key
+        return block.operations[index]
+
     def get_result_var(self, position_key):
-        _, block, index = position_key
-        op = block.operations[index]
+        op = self.get_op(position_key)
         v_result = op.result
         self.var_def[v_result] = position_key
         return v_result
diff --git a/rpython/annotator/bookkeeper.py b/rpython/annotator/bookkeeper.py
--- a/rpython/annotator/bookkeeper.py
+++ b/rpython/annotator/bookkeeper.py
@@ -499,10 +499,8 @@
             whence = emulated
 
         if whence is not None:
-            fn, block, i = whence
-            op = block.operations[i]
-            v_result = op.result
-            self.annotator.var_def[v_result] = whence
+            op = self.annotator.get_op(whence)
+            v_result = self.annotator.get_result_var(whence)
         else:
             op = None
             v_result = None
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to