summaryrefslogtreecommitdiff
path: root/giscanner
diff options
context:
space:
mode:
authorPhilip Withnall <philip.withnall@collabora.co.uk>2014-05-06 17:51:24 +0100
committerColin Walters <walters@verbum.org>2015-10-04 17:41:57 -0400
commit0a134a608f5b471c3a12739785e149ceaf90df27 (patch)
tree0474102c6cf23d023eb32e461c48d396051df80d /giscanner
parent09c466f0184e74ba6f279f103ad3be3a7e1f2a06 (diff)
downloadgobject-introspection-0a134a608f5b471c3a12739785e149ceaf90df27.tar.gz
giscanner: Mark (closure) parameters as (nullable) by convention
All user_data pointers should be nullable, and they should all be annotated as closures too. I have not found any counter-examples where a closure is non-nullable. https://bugzilla.gnome.org/show_bug.cgi?id=729660
Diffstat (limited to 'giscanner')
-rw-r--r--giscanner/maintransformer.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/giscanner/maintransformer.py b/giscanner/maintransformer.py
index bb79a5b3..8bac1430 100644
--- a/giscanner/maintransformer.py
+++ b/giscanner/maintransformer.py
@@ -1438,6 +1438,13 @@ method or constructor of some type."""
param.argname is not None and
param.argname.endswith('data')):
callback_param.closure_name = param.argname
+ param.closure_name = param.argname
+
+ for param in params:
+ # By convention, closure user_data parameters are always nullable.
+ if param.closure_name is not None and \
+ param.closure_name == param.argname:
+ param.nullable = True
def _pass3_callable_throws(self, node):
"""Check to see if we have anything that looks like a