summaryrefslogtreecommitdiff
path: root/giscanner/girwriter.py
diff options
context:
space:
mode:
authorJasper St. Pierre <jstpierre@mecheye.net>2013-01-31 09:36:07 -0500
committerJasper St. Pierre <jstpierre@mecheye.net>2013-02-01 19:37:21 -0500
commit9c0bd59b021e163eae191db95ce6beeb389cbd6f (patch)
tree1e6030b1baebe66c68877b038ca3444a12a50d96 /giscanner/girwriter.py
parent93cd5b208b19e7c532972b85a457518082e1fc2b (diff)
downloadgobject-introspection-9c0bd59b021e163eae191db95ce6beeb389cbd6f.tar.gz
girparser: Serialize and read back the instance_parameter
g-ir-doc-tool wants to use the instance parameter to read docs and the parameter name, so it needs to be shuttled through the GIR. https://bugzilla.gnome.org/show_bug.cgi?id=693040
Diffstat (limited to 'giscanner/girwriter.py')
-rw-r--r--giscanner/girwriter.py18
1 files changed, 10 insertions, 8 deletions
diff --git a/giscanner/girwriter.py b/giscanner/girwriter.py
index e9910d47..c54a5389 100644
--- a/giscanner/girwriter.py
+++ b/giscanner/girwriter.py
@@ -170,7 +170,7 @@ and/or use gtk-doc annotations. ''')
with self.tagcontext(tag_name, attrs):
self._write_generic(callable)
self._write_return_type(callable.retval, parent=callable)
- self._write_parameters(callable, callable.parameters)
+ self._write_parameters(callable)
def _write_function(self, func, tag_name='function'):
attrs = []
@@ -206,14 +206,16 @@ and/or use gtk-doc annotations. ''')
self._write_generic(return_)
self._write_type(return_.type, function=parent)
- def _write_parameters(self, parent, parameters):
- if not parameters:
+ def _write_parameters(self, callable):
+ if not callable.parameters and callable.instance_parameter is None:
return
with self.tagcontext('parameters'):
- for parameter in parameters:
- self._write_parameter(parent, parameter)
+ if callable.instance_parameter:
+ self._write_parameter(callable, callable.instance_parameter, 'instance-parameter')
+ for parameter in callable.parameters:
+ self._write_parameter(callable, parameter)
- def _write_parameter(self, parent, parameter):
+ def _write_parameter(self, parent, parameter, nodename='parameter'):
attrs = []
if parameter.argname is not None:
attrs.append(('name', parameter.argname))
@@ -236,7 +238,7 @@ and/or use gtk-doc annotations. ''')
attrs.append(('destroy', '%d' % (idx, )))
if parameter.skip:
attrs.append(('skip', '1'))
- with self.tagcontext('parameter', attrs):
+ with self.tagcontext(nodename, attrs):
self._write_generic(parameter)
self._write_type(parameter.type, function=parent)
@@ -585,4 +587,4 @@ and/or use gtk-doc annotations. ''')
with self.tagcontext('glib:signal', attrs):
self._write_generic(signal)
self._write_return_type(signal.retval)
- self._write_parameters(signal, signal.parameters)
+ self._write_parameters(signal)