summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohan Dahlin <johan@gnome.org>2009-12-09 16:38:43 -0200
committerJohan Dahlin <johan@gnome.org>2009-12-09 16:39:47 -0200
commit0e68edfaeaee03bb8e23b09869d398d2460c75a0 (patch)
tree1a9c840dba391310e168a19ea2f12b4e6a438d13
parent0910fc4205792557edbf80205d07a8729e193f33 (diff)
downloadgobject-introspection-0e68edfaeaee03bb8e23b09869d398d2460c75a0.tar.gz
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
-rw-r--r--giscanner/annotationparser.py2
-rw-r--r--tests/scanner/annotation-1.0-expected.gir11
-rw-r--r--tests/scanner/annotation-1.0-expected.tgir10
-rw-r--r--tests/scanner/annotation.c19
4 files changed, 41 insertions, 1 deletions
diff --git a/giscanner/annotationparser.py b/giscanner/annotationparser.py
index c65a8328..18c40edc 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 33d5e7c6..2eef2100 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&apos;s not
known by GObject as it&apos;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 835a547a..15071748 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 058d508a..fb025b97 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