diff options
author | Johan Dahlin <jdahlin@async.com.br> | 2008-06-20 22:27:07 +0000 |
---|---|---|
committer | Johan Dahlin <johan@src.gnome.org> | 2008-06-20 22:27:07 +0000 |
commit | a06270d391b6b2704cf7f2445d17e7ab30e1134f (patch) | |
tree | ce60213409da05edba32b80fe343440b62878db3 /giscanner | |
parent | b9767e2fe9955e38612d890f9435cff14e215936 (diff) | |
download | gobject-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.py | 1 | ||||
-rw-r--r-- | giscanner/girwriter.py | 2 | ||||
-rw-r--r-- | giscanner/transformer.py | 2 |
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,) |