summaryrefslogtreecommitdiff
path: root/giscanner
diff options
context:
space:
mode:
Diffstat (limited to 'giscanner')
-rw-r--r--giscanner/ast.py7
-rw-r--r--giscanner/girparser.py2
-rw-r--r--giscanner/girwriter.py2
3 files changed, 8 insertions, 3 deletions
diff --git a/giscanner/ast.py b/giscanner/ast.py
index 35a764a7..12304eb7 100644
--- a/giscanner/ast.py
+++ b/giscanner/ast.py
@@ -775,13 +775,14 @@ class Parameter(TypeContainer):
"""An argument to a function."""
def __init__(self, argname, typenode, direction=None,
- transfer=None, allow_none=False, scope=None,
+ transfer=None, nullable=False, optional=False,
+ allow_none=False, scope=None,
caller_allocates=False):
TypeContainer.__init__(self, typenode, transfer)
self.argname = argname
self.direction = direction
- self.nullable = False
- self.optional = False
+ self.nullable = nullable
+ self.optional = optional
if allow_none:
if self.direction == PARAM_DIRECTION_OUT:
diff --git a/giscanner/girparser.py b/giscanner/girparser.py
index cac166d0..b1583998 100644
--- a/giscanner/girparser.py
+++ b/giscanner/girparser.py
@@ -280,6 +280,8 @@ class GIRParser(object):
typeval,
node.attrib.get('direction') or ast.PARAM_DIRECTION_IN,
node.attrib.get('transfer-ownership'),
+ node.attrib.get('nullable') == '1',
+ node.attrib.get('optional') == '1',
node.attrib.get('allow-none') == '1',
node.attrib.get('scope'),
node.attrib.get('caller-allocates') == '1')
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: