Ronan Lamy  committed 3ab58f5

Simplify creation of hlop proxy methods on FlowObjSpace

  • Participants
  • Parent commits f0d93e1
  • Branches less-stringly-ops

Comments (0)

Files changed (2)

File rpython/flowspace/

                 raise FlowingError("global name '%s' is not defined" % varname)
         return const(value)
-def make_op(cls):
-    def generic_operator(self, *args):
-        return cls(*args).eval(self.frame)
-    return generic_operator
 for cls in op.__dict__.values():
     if getattr(FlowObjSpace, cls.opname, None) is None:
-        setattr(FlowObjSpace, cls.opname, make_op(cls))
+        setattr(FlowObjSpace, cls.opname, cls.make_sc())
 def build_flow(func, space=FlowObjSpace()):

File rpython/flowspace/

         # this is an incomplete list of true constants.
         # if we add much more, a dedicated class
         # might be considered for special objects.
-        }
 class _OpHolder(object): pass
 class HLOperation(SpaceOperation):
     pure = False
     def __init__(self, *args):
         if len(args) != self.arity:
             raise TypeError(self.opname + " got the wrong number of arguments")
                     raise Exception("should call %r with exactly %d arguments" % (
                         cls.opname, cls.arity))
-            # completely replace the call with the underlying
-            # operation and its limited implicit exceptions semantic
-            return getattr(space, cls.opname)(*args_w)
+            return cls(*args_w).eval(space.frame)
         return sc_operator
     def eval(self, frame):