[gobject-introspection] giscanner: Store direction in TypeContainer instance



commit 483c612363d9faa81992a2a52f6b5e82a7d65fe1
Author: Philip Withnall <philip withnall collabora co uk>
Date:   Thu Apr 16 10:57:32 2015 +0100

    giscanner: Store direction in TypeContainer instance
    
    Instead of storing a direction property on both Parameter and Return
    separately, hoist it up to TypeContainer so it’s inherited. This neatens
    things up a bit, but doesn’t really change anything in practice.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=747979

 giscanner/ast.py |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/giscanner/ast.py b/giscanner/ast.py
index 721aafc..0c31b8a 100644
--- a/giscanner/ast.py
+++ b/giscanner/ast.py
@@ -846,10 +846,11 @@ class Alias(Node):
 class TypeContainer(Annotated):
     """A fundamental base class for Return and Parameter."""
 
-    def __init__(self, typenode, nullable, transfer):
+    def __init__(self, typenode, nullable, transfer, direction):
         Annotated.__init__(self)
         self.type = typenode
         self.nullable = nullable
+        self.direction = direction
         if transfer is not None:
             self.transfer = transfer
         elif typenode.is_const:
@@ -865,9 +866,8 @@ class Parameter(TypeContainer):
                  transfer=None, nullable=False, optional=False,
                  allow_none=False, scope=None,
                  caller_allocates=False):
-        TypeContainer.__init__(self, typenode, nullable, transfer)
+        TypeContainer.__init__(self, typenode, nullable, transfer, direction)
         self.argname = argname
-        self.direction = direction
         self.optional = optional
         self.parent = None  # A Callable
 
@@ -887,8 +887,8 @@ class Return(TypeContainer):
     """A return value from a function."""
 
     def __init__(self, rtype, nullable=False, transfer=None):
-        TypeContainer.__init__(self, rtype, nullable, transfer)
-        self.direction = PARAM_DIRECTION_OUT
+        TypeContainer.__init__(self, rtype, nullable, transfer,
+                               direction=PARAM_DIRECTION_OUT)
         self.parent = None  # A Callable
 
 


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