diff options
author | Ryan Lortie <desrt@desrt.ca> | 2014-04-16 18:05:07 -0400 |
---|---|---|
committer | Ryan Lortie <desrt@desrt.ca> | 2014-05-06 08:18:41 -0400 |
commit | 17b19cfcad236fd2def64b9aac454ecb3cd42e8d (patch) | |
tree | 3538405d943fbb4dc81191a61fcc497f20c2ed39 /giscanner/ast.py | |
parent | 1459ff3eb242327fca8a2b5a696b14b7e46afdee (diff) | |
download | gobject-introspection-17b19cfcad236fd2def64b9aac454ecb3cd42e8d.tar.gz |
giscanner: support nullable return types too
Promote the 'nullable' field to the TypeContainer base class (which is
shared by Return and Parameter types).
Add .gir support for nullability on return values, both in the writer
and in the (scanner's) parser.
https://bugzilla.gnome.org/show_bug.cgi?id=660879
Diffstat (limited to 'giscanner/ast.py')
-rw-r--r-- | giscanner/ast.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/giscanner/ast.py b/giscanner/ast.py index 12304eb7..a9537e8d 100644 --- a/giscanner/ast.py +++ b/giscanner/ast.py @@ -760,9 +760,10 @@ class Alias(Node): class TypeContainer(Annotated): """A fundamental base class for Return and Parameter.""" - def __init__(self, typenode, transfer): + def __init__(self, typenode, nullable, transfer): Annotated.__init__(self) self.type = typenode + self.nullable = nullable if transfer is not None: self.transfer = transfer elif typenode.is_const: @@ -778,10 +779,9 @@ class Parameter(TypeContainer): transfer=None, nullable=False, optional=False, allow_none=False, scope=None, caller_allocates=False): - TypeContainer.__init__(self, typenode, transfer) + TypeContainer.__init__(self, typenode, nullable, transfer) self.argname = argname self.direction = direction - self.nullable = nullable self.optional = optional if allow_none: @@ -799,8 +799,8 @@ class Parameter(TypeContainer): class Return(TypeContainer): """A return value from a function.""" - def __init__(self, rtype, transfer=None): - TypeContainer.__init__(self, rtype, transfer) + def __init__(self, rtype, nullable=False, transfer=None): + TypeContainer.__init__(self, rtype, nullable, transfer) self.direction = PARAM_DIRECTION_OUT |