[pypy-commit] pypy less-stringly-ops: make ArgumentsForTranslation a subclass of CallSpec

rlamy noreply at buildbot.pypy.org
Tue Nov 19 02:43:50 CET 2013


Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: less-stringly-ops
Changeset: r68231:5f4e3a547a2c
Date: 2013-11-18 22:07 +0000
http://bitbucket.org/pypy/pypy/changeset/5f4e3a547a2c/

Log:	make ArgumentsForTranslation a subclass of CallSpec

diff --git a/rpython/annotator/argument.py b/rpython/annotator/argument.py
--- a/rpython/annotator/argument.py
+++ b/rpython/annotator/argument.py
@@ -2,22 +2,9 @@
 Arguments objects.
 """
 from rpython.annotator.model import SomeTuple
+from rpython.flowspace.argument import CallSpec
 
-class ArgumentsForTranslation(object):
-    def __init__(self, args_w, keywords=None, w_stararg=None):
-        self.w_stararg = w_stararg
-        assert isinstance(args_w, list)
-        self.arguments_w = args_w
-        self.keywords = keywords or {}
-
-    def __repr__(self):
-        """ NOT_RPYTHON """
-        name = self.__class__.__name__
-        if not self.keywords:
-            return '%s(%s)' % (name, self.arguments_w,)
-        else:
-            return '%s(%s, %s)' % (name, self.arguments_w, self.keywords)
-
+class ArgumentsForTranslation(CallSpec):
     @property
     def positional_args(self):
         if self.w_stararg is not None:
diff --git a/rpython/flowspace/argument.py b/rpython/flowspace/argument.py
--- a/rpython/flowspace/argument.py
+++ b/rpython/flowspace/argument.py
@@ -83,6 +83,14 @@
         self.arguments_w = args_w
         self.keywords = keywords or {}
 
+    def __repr__(self):
+        """ NOT_RPYTHON """
+        name = self.__class__.__name__
+        if not self.keywords:
+            return '%s(%s)' % (name, self.arguments_w,)
+        else:
+            return '%s(%s, %s)' % (name, self.arguments_w, self.keywords)
+
     def flatten(self):
         """ Argument <-> list of w_objects together with "shape" information """
         shape_cnt  = len(self.arguments_w)    # Number of positional args


More information about the pypy-commit mailing list