From 89d51bce0feb115a1b73f32b023bfabaeec9fde1 Mon Sep 17 00:00:00 2001 From: Ryan Lortie Date: Wed, 16 Apr 2014 11:22:32 -0400 Subject: 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 --- giscanner/girwriter.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'giscanner/girwriter.py') 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: -- cgit v1.2.1