summaryrefslogtreecommitdiff
path: root/giscanner
diff options
context:
space:
mode:
authorJohan Dahlin <jdahlin@async.com.br>2008-06-20 22:27:07 +0000
committerJohan Dahlin <johan@src.gnome.org>2008-06-20 22:27:07 +0000
commita06270d391b6b2704cf7f2445d17e7ab30e1134f (patch)
treece60213409da05edba32b80fe343440b62878db3 /giscanner
parentb9767e2fe9955e38612d890f9435cff14e215936 (diff)
downloadgobject-introspection-a06270d391b6b2704cf7f2445d17e7ab30e1134f.tar.gz
Add support for gtk-doc annotations for allow-none. Add test case.
2008-06-20 Johan Dahlin <jdahlin@async.com.br> * giscanner/ast.py: * giscanner/girwriter.py: * giscanner/transformer.py: * tests/parser/Foo-expected.gir: * tests/parser/foo-object.h: * tests/parser/foo.c (foo_object_allow_none): Add support for gtk-doc annotations for allow-none. Add test case. svn path=/trunk/; revision=291
Diffstat (limited to 'giscanner')
-rw-r--r--giscanner/ast.py1
-rw-r--r--giscanner/girwriter.py2
-rw-r--r--giscanner/transformer.py2
3 files changed, 5 insertions, 0 deletions
diff --git a/giscanner/ast.py b/giscanner/ast.py
index 80d5f968..ca5e66d5 100644
--- a/giscanner/ast.py
+++ b/giscanner/ast.py
@@ -142,6 +142,7 @@ class Parameter(Node):
self.type = typenode
self.direction = PARAM_DIRECTION_IN
self.transfer = False
+ self.allow_none = False
def __repr__(self):
return 'Parameter(%r, %r)' % (self.name, self.type)
diff --git a/giscanner/girwriter.py b/giscanner/girwriter.py
index 389c05fa..af297e79 100644
--- a/giscanner/girwriter.py
+++ b/giscanner/girwriter.py
@@ -110,6 +110,8 @@ class GIRWriter(XMLWriter):
if parameter.transfer:
attrs.append(('transfer-ownership',
str(int(parameter.transfer))))
+ if parameter.allow_none:
+ attrs.append(('allow-none', '1'))
with self.tagcontext('parameter', attrs):
self._write_type(parameter.type)
diff --git a/giscanner/transformer.py b/giscanner/transformer.py
index 5a6b021b..6f7e2a35 100644
--- a/giscanner/transformer.py
+++ b/giscanner/transformer.py
@@ -221,6 +221,8 @@ class Transformer(object):
param.direction = 'out'
elif option == 'callee-owns':
param.transfer = True
+ elif option == 'allow-none':
+ param.allow_none = True
else:
print 'Unhandled parameter annotation option: %s' % (
option,)