[gobject-introspection] giscanner: don't ignore signal parameter names from annotations.
- From: Pavel Holejsovsky <pholejs src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gobject-introspection] giscanner: don't ignore signal parameter names from annotations.
- Date: Wed, 15 Dec 2010 08:45:58 +0000 (UTC)
commit 0729fee228c0c492d10dcf9827903b94a077433d
Author: Pavel Holejsovsky <pavel holejsovsky gmail com>
Date: Tue Dec 14 16:14:55 2010 +0100
giscanner: don't ignore signal parameter names from annotations.
If present in annotation, use parameter names from annotation instead
of (object, p0, p1, ...) names generated by dumpparser.
Assign names for all parameters before trying to resolve annotation
types, so that annotations containing forward references to other
arguments, e.g.
* GApplication::open:
* @application: the application
* @files: (array length=n_files) (element-type GFile): an array of #GFiles
* @n_files: the length of @files
giscanner/maintransformer.py | 5 ++++-
tests/scanner/Regress-1.0-expected.gir | 6 +++---
2 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/giscanner/maintransformer.py b/giscanner/maintransformer.py
index 4ae5516..9729d4d 100644
--- a/giscanner/maintransformer.py
+++ b/giscanner/maintransformer.py
@@ -719,12 +719,15 @@ usage is void (*_gtk_reserved1)(void);"""
# than the number of signal parameters
if block and len(block.tags) > len(signal.parameters):
names = block.tags.items()
+ # Resolve real parameter names early, so that in later
+ # phase we can refer to them while resolving annotations.
+ for i, param in enumerate(signal.parameters):
+ param.argname, tag = names[i+1]
else:
names = []
for i, param in enumerate(signal.parameters):
if names:
name, tag = names[i+1]
- param.name = name
options = getattr(tag, 'options', {})
param_type = options.get(OPT_TYPE)
if param_type:
diff --git a/tests/scanner/Regress-1.0-expected.gir b/tests/scanner/Regress-1.0-expected.gir
index c0590d7..17e130d 100644
--- a/tests/scanner/Regress-1.0-expected.gir
+++ b/tests/scanner/Regress-1.0-expected.gir
@@ -630,7 +630,7 @@ case.</doc>
<type name="none"/>
</return-value>
<parameters>
- <parameter name="object" transfer-ownership="none">
+ <parameter name="arr" transfer-ownership="none">
<doc xml:whitespace="preserve">numbers</doc>
<array name="GLib.Array">
<type name="guint"/>
@@ -645,7 +645,7 @@ TpAccount::status-changed</doc>
<type name="none"/>
</return-value>
<parameters>
- <parameter name="object" transfer-ownership="none">
+ <parameter name="hash" transfer-ownership="none">
<type name="GLib.HashTable">
<type name="utf8"/>
<type name="GObject.Value"/>
@@ -659,7 +659,7 @@ TpAccount::status-changed</doc>
<type name="none"/>
</return-value>
<parameters>
- <parameter name="object" transfer-ownership="none">
+ <parameter name="strs" transfer-ownership="none">
<doc xml:whitespace="preserve">strings</doc>
<array>
<type name="utf8"/>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]