summaryrefslogtreecommitdiff
path: root/giscanner/girwriter.py
diff options
context:
space:
mode:
authorRyan Lortie <desrt@desrt.ca>2014-04-16 11:22:32 -0400
committerRyan Lortie <desrt@desrt.ca>2014-05-06 08:15:24 -0400
commit89d51bce0feb115a1b73f32b023bfabaeec9fde1 (patch)
treebfe3ef15f2814d85bdd86cb43ca36224c8eae179 /giscanner/girwriter.py
parent754f1965c08bb01b2e6440d2a6f1ab9edd6e1970 (diff)
downloadgobject-introspection-89d51bce0feb115a1b73f32b023bfabaeec9fde1.tar.gz
giscanner: write nullable and optional attributes
Record our internal 'nullable' and 'optional' attributes into the written .gir file. It is now theoretically possible to express the concept of an out parameter with a nullable type (although presently there is no way to do this). Modify our own internal parser (in the scanner) to understand the newly-written attributes. Update the expected output of the 'Regress-1.0.gir' test to account for the new attributes. Nothing else understands 'nullable' yet, but the girparser in the typelib compiler already understands 'optional' and records a bit for it in the typelib. https://bugzilla.gnome.org/show_bug.cgi?id=660879
Diffstat (limited to 'giscanner/girwriter.py')
-rw-r--r--giscanner/girwriter.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/giscanner/girwriter.py b/giscanner/girwriter.py
index 49d24bc4..49545e62 100644
--- a/giscanner/girwriter.py
+++ b/giscanner/girwriter.py
@@ -240,9 +240,11 @@ class GIRWriter(XMLWriter):
attrs.append(('transfer-ownership',
parameter.transfer))
if parameter.nullable:
+ attrs.append(('nullable', '1'))
if parameter.direction != ast.PARAM_DIRECTION_OUT:
attrs.append(('allow-none', '1'))
if parameter.optional:
+ attrs.append(('optional', '1'))
if parameter.direction == ast.PARAM_DIRECTION_OUT:
attrs.append(('allow-none', '1'))
if parameter.scope: