summaryrefslogtreecommitdiff
path: root/giscanner/ast.py
diff options
context:
space:
mode:
authorPhilip Withnall <philip.withnall@collabora.co.uk>2014-06-20 13:52:14 +0100
committerColin Walters <walters@verbum.org>2015-10-04 17:46:09 -0400
commit10cb665fee2cc378dd2f13bad16e6384836a8b16 (patch)
tree3d699aa40290c4902774233290ec89d277ff9dec /giscanner/ast.py
parent0a134a608f5b471c3a12739785e149ceaf90df27 (diff)
downloadgobject-introspection-10cb665fee2cc378dd2f13bad16e6384836a8b16.tar.gz
giscanner: Mark gpointer nodes as nullable by default
gpointer parameters and return types should be marked as nullable by default, unless: • also annotated with (type) and not with (nullable); or • explicitly annotated with (not nullable). This introduces the (not nullable) annotation as a direct opposite to (nullable). In future, (not) could be extended to invert other annotations. https://bugzilla.gnome.org/show_bug.cgi?id=729660
Diffstat (limited to 'giscanner/ast.py')
-rw-r--r--giscanner/ast.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/giscanner/ast.py b/giscanner/ast.py
index aeb49ed2..99bbd3e1 100644
--- a/giscanner/ast.py
+++ b/giscanner/ast.py
@@ -845,10 +845,11 @@ class Alias(Node):
class TypeContainer(Annotated):
"""A fundamental base class for Return and Parameter."""
- def __init__(self, typenode, nullable, transfer, direction):
+ def __init__(self, typenode, nullable, not_nullable, transfer, direction):
Annotated.__init__(self)
self.type = typenode
self.nullable = nullable
+ self.not_nullable = not_nullable
self.direction = direction
if transfer is not None:
self.transfer = transfer
@@ -864,8 +865,9 @@ class Parameter(TypeContainer):
def __init__(self, argname, typenode, direction=None,
transfer=None, nullable=False, optional=False,
allow_none=False, scope=None,
- caller_allocates=False):
- TypeContainer.__init__(self, typenode, nullable, transfer, direction)
+ caller_allocates=False, not_nullable=False):
+ TypeContainer.__init__(self, typenode, nullable, not_nullable,
+ transfer, direction)
self.argname = argname
self.optional = optional
self.parent = None # A Callable
@@ -889,8 +891,9 @@ class Parameter(TypeContainer):
class Return(TypeContainer):
"""A return value from a function."""
- def __init__(self, rtype, nullable=False, transfer=None):
- TypeContainer.__init__(self, rtype, nullable, transfer,
+ def __init__(self, rtype, nullable=False, not_nullable=False,
+ transfer=None):
+ TypeContainer.__init__(self, rtype, nullable, not_nullable, transfer,
direction=PARAM_DIRECTION_OUT)
self.parent = None # A Callable