Fix an annotationparser bug for empty tags
authorJohan Dahlin <johan@gnome.org>
Wed, 9 Dec 2009 18:38:43 +0000 (16:38 -0200)
committerJohan Dahlin <johan@gnome.org>
Wed, 9 Dec 2009 18:39:47 +0000 (16:39 -0200)
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
tests/scanner/annotation-1.0-expected.gir
tests/scanner/annotation-1.0-expected.tgir
tests/scanner/annotation.c

index c65a832..18c40ed 100644 (file)
@@ -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)
index 33d5e7c..2eef210 100644 (file)
@@ -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">
index 835a547..1507174 100644 (file)
       <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"/>
index 058d508..fb025b9 100644 (file)
@@ -12,6 +12,7 @@ enum {
 enum {
   STRING_SIGNAL,
   LIST_SIGNAL,
+  DOC_EMPTY_ARG_PARSING,
   LAST_SIGNAL
 };
 
@@ -96,6 +97,22 @@ annotation_object_class_init (AnnotationObjectClass *klass)
                  (GSignalCMarshaller)g_cclosure_marshal_VOID__POINTER,
                  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:
    *
@@ -111,7 +128,7 @@ annotation_object_class_init (AnnotationObjectClass *klass)
                                                         "This property is a string",
                                                         NULL,
                                                         G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
-  
+
 }
 
 static void