[gobject-introspection] Fix an annotationparser bug for empty tags
- From: Johan Dahlin <johan src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gobject-introspection] Fix an annotationparser bug for empty tags
- Date: Wed, 9 Dec 2009 18:40:12 +0000 (UTC)
commit 0e68edfaeaee03bb8e23b09869d398d2460c75a0
Author: Johan Dahlin <johan gnome org>
Date: Wed Dec 9 16:38:43 2009 -0200
Fix an annotationparser bug for empty tags
Makes sure we can parse empty tags such as '@foo:' without
adding a : in the end which the typelib compiler will complain
about
giscanner/annotationparser.py | 2 ++
tests/scanner/annotation-1.0-expected.gir | 11 +++++++++++
tests/scanner/annotation-1.0-expected.tgir | 10 ++++++++++
tests/scanner/annotation.c | 19 ++++++++++++++++++-
4 files changed, 41 insertions(+), 1 deletions(-)
---
diff --git a/giscanner/annotationparser.py b/giscanner/annotationparser.py
index c65a832..18c40ed 100644
--- a/giscanner/annotationparser.py
+++ b/giscanner/annotationparser.py
@@ -222,6 +222,8 @@ class AnnotationParser(object):
if len(parts) == 1:
tag_name = parts[0]
value = ''
+ if tag_name.endswith(':'):
+ tag_name = tag_name[:-1]
else:
tag_name, value = parts
return (tag_name, value)
diff --git a/tests/scanner/annotation-1.0-expected.gir b/tests/scanner/annotation-1.0-expected.gir
index 33d5e7c..2eef210 100644
--- a/tests/scanner/annotation-1.0-expected.gir
+++ b/tests/scanner/annotation-1.0-expected.gir
@@ -486,6 +486,17 @@ type.">
<field name="parent_instance">
<type name="GObject.Object" c:type="GObject"/>
</field>
+ <glib:signal name="doc-empty-arg-parsing"
+ doc="This signal tests an empty document argument (@arg1)">
+ <return-value transfer-ownership="full">
+ <type name="none" c:type="void"/>
+ </return-value>
+ <parameters>
+ <parameter name="arg1" transfer-ownership="none">
+ <type name="any" c:type="gpointer"/>
+ </parameter>
+ </parameters>
+ </glib:signal>
<glib:signal name="list-signal"
doc="This is a signal which takes a list of strings, but it's not
known by GObject as it's only marked as G_TYPE_POINTER">
diff --git a/tests/scanner/annotation-1.0-expected.tgir b/tests/scanner/annotation-1.0-expected.tgir
index 835a547..1507174 100644
--- a/tests/scanner/annotation-1.0-expected.tgir
+++ b/tests/scanner/annotation-1.0-expected.tgir
@@ -359,6 +359,16 @@
<property name="string-property" writable="1" construct="1">
<type name="utf8"/>
</property>
+ <glib:signal name="doc-empty-arg-parsing" when="LAST">
+ <return-value transfer-ownership="full">
+ <type name="none"/>
+ </return-value>
+ <parameters>
+ <parameter name="arg1" transfer-ownership="none">
+ <type name="any"/>
+ </parameter>
+ </parameters>
+ </glib:signal>
<glib:signal name="list-signal" when="LAST">
<return-value transfer-ownership="full">
<type name="none"/>
diff --git a/tests/scanner/annotation.c b/tests/scanner/annotation.c
index 058d508..fb025b9 100644
--- a/tests/scanner/annotation.c
+++ b/tests/scanner/annotation.c
@@ -12,6 +12,7 @@ enum {
enum {
STRING_SIGNAL,
LIST_SIGNAL,
+ DOC_EMPTY_ARG_PARSING,
LAST_SIGNAL
};
@@ -97,6 +98,22 @@ annotation_object_class_init (AnnotationObjectClass *klass)
G_TYPE_NONE, 1, G_TYPE_POINTER);
/**
+ * AnnotationObject::doc-empty-arg-parsing:
+ * @annotation: the annotation object
+ * @arg1:
+ *
+ * This signal tests an empty document argument (@arg1)
+ */
+ annotation_object_signals[DOC_EMPTY_ARG_PARSING] =
+ g_signal_new ("doc-empty-arg-parsing",
+ G_OBJECT_CLASS_TYPE (gobject_class),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL, NULL,
+ (GSignalCMarshaller)g_cclosure_marshal_VOID__POINTER,
+ G_TYPE_NONE, 1, G_TYPE_POINTER);
+
+ /**
* AnnotationObject:string-property:
*
* This is a property which is a string
@@ -111,7 +128,7 @@ annotation_object_class_init (AnnotationObjectClass *klass)
"This property is a string",
NULL,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
-
+
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]