[gobject-introspection] giscanner: emit 'incorrect number of parameters in comment block' warning
- From: Dieter Verfaillie <dieterv src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gobject-introspection] giscanner: emit 'incorrect number of parameters in comment block' warning
- Date: Tue, 7 May 2013 21:55:17 +0000 (UTC)
commit a031129d8ab28e2f51e95e7266f1274bdc592557
Author: Dieter Verfaillie <dieterv optionexplicit be>
Date: Wed Jan 9 17:20:11 2013 +0100
giscanner: emit 'incorrect number of parameters in comment block' warning
instead of silently ignoring parameter names on signals when the
number of parameters doesn't match our expectations.
https://bugzilla.gnome.org/show_bug.cgi?id=697623
giscanner/maintransformer.py | 30 ++++++++++++++++++------------
1 files changed, 18 insertions(+), 12 deletions(-)
---
diff --git a/giscanner/maintransformer.py b/giscanner/maintransformer.py
index 28ffed3..8292f8e 100644
--- a/giscanner/maintransformer.py
+++ b/giscanner/maintransformer.py
@@ -780,20 +780,26 @@ usage is void (*_gtk_reserved1)(void);"""
prop.type = self._resolve_toplevel(type_tag.value, prop.type, prop, parent)
def _apply_annotations_signal(self, parent, signal):
+ names = []
prefix = self._get_annotation_name(parent)
block = self._blocks.get('%s::%s' % (prefix, signal.name))
- self._apply_annotations_annotated(signal, block)
- # We're only attempting to name the signal parameters if
- # the number of parameters (@foo) is the same or greater
- # than the number of signal parameters
- if block and len(block.params) > len(signal.parameters):
- names = block.params.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 = []
+
+ if block:
+ self._apply_annotations_annotated(signal, block)
+
+ # We're only attempting to name the signal parameters if
+ # the number of parameters (@foo) is the same or greater
+ # than the number of signal parameters
+ if len(block.params) > len(signal.parameters):
+ names = block.params.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:
+ message.warn("incorrect number of parameters in comment block, "
+ "parameter annotations will be ignored.", block.position)
+
for i, param in enumerate(signal.parameters):
if names:
name, tag = names[i+1]
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]