[gobject-introspection] ast: Add a new all_parameters property to Callable



commit 54734b195dda07a935470b64e0654101f5528b94
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Fri Feb 1 20:01:39 2013 -0500

    ast: Add a new all_parameters property to Callable
    
    This will be used by the doctool to show the self parameter in C
    and Python docs.

 giscanner/ast.py |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/giscanner/ast.py b/giscanner/ast.py
index 1831332..3092d67 100644
--- a/giscanner/ast.py
+++ b/giscanner/ast.py
@@ -582,6 +582,14 @@ class Callable(Node):
         self.instance_parameter = None # Parameter
         self.parent = None # A Class or Interface
 
+    # Returns all parameters, including the instance parameter
+    @property
+    def all_parameters(self):
+        if self.instance_parameter is not None:
+            return [self.instance_parameter] + self.parameters
+        else:
+            return self.parameters
+
     def get_parameter_index(self, name):
         for i, parameter in enumerate(self.parameters):
             if parameter.argname == name:



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]