summaryrefslogtreecommitdiff
path: root/giscanner/ast.py
diff options
context:
space:
mode:
authorPhilip Withnall <philip.withnall@collabora.co.uk>2015-04-16 10:57:32 +0100
committerColin Walters <walters@verbum.org>2015-09-29 23:55:06 -0400
commit483c612363d9faa81992a2a52f6b5e82a7d65fe1 (patch)
tree5dbfa560283ddee747c2c1035ee88416ef700a5d /giscanner/ast.py
parentdba9c486bfe77e7bd67cbf31ead19e73b971b542 (diff)
downloadgobject-introspection-483c612363d9faa81992a2a52f6b5e82a7d65fe1.tar.gz
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
Diffstat (limited to 'giscanner/ast.py')
-rw-r--r--giscanner/ast.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/giscanner/ast.py b/giscanner/ast.py
index 721aafcd..0c31b8a8 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