Author: Ronan Lamy <[email protected]>
Branch: less-stringly-ops
Changeset: r66234:1a725470629d
Date: 2013-08-09 06:30 +0100
http://bitbucket.org/pypy/pypy/changeset/1a725470629d/
Log: Allow creating the SpaceOperation directly from the SpaceOperator
diff --git a/rpython/flowspace/flowcontext.py b/rpython/flowspace/flowcontext.py
--- a/rpython/flowspace/flowcontext.py
+++ b/rpython/flowspace/flowcontext.py
@@ -452,10 +452,11 @@
recorder.append(spaceop)
def do_op(self, operator, *args_w):
- w_result = self.do_operation(operator.name, *args_w)
+ op = operator(*args_w)
+ self.record(op)
if operator.canraise:
self.guessexception(operator.canraise)
- return w_result
+ return op.result
def guessexception(self, exceptions):
"""
diff --git a/rpython/flowspace/operation.py b/rpython/flowspace/operation.py
--- a/rpython/flowspace/operation.py
+++ b/rpython/flowspace/operation.py
@@ -7,7 +7,7 @@
import __future__
import operator
from rpython.tool.sourcetools import compile2
-from rpython.flowspace.model import Constant, WrapException, const
+from rpython.flowspace.model import Constant, WrapException, const, Variable
from rpython.flowspace.specialcase import register_flow_sc
class _OpHolder(object): pass
@@ -45,6 +45,9 @@
raise TypeError(self.name + " got the wrong number of arguments")
return frame.do_op(self, *args_w)
+ def __call__(self, *args_w):
+ return SpaceOperation(self.name, args_w, Variable())
+
class PureOperator(SpaceOperator):
pure = True
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit