]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
girwriter: write GArray and GPtrArray to GIRs as arrays.
authorEvan Nemerson <evan@coeus-group.com>
Tue, 20 Nov 2012 23:17:53 +0000 (15:17 -0800)
committerEvan Nemerson <evan@coeus-group.com>
Tue, 20 Nov 2012 23:17:53 +0000 (15:17 -0800)
codegen/valagirwriter.vala

index 597cdaccaf4197529229ec1fc33b0035e0ba65fe..3f743d35bf1ad8f43f8dfb89e9bebc040978ea22 100644 (file)
@@ -1269,7 +1269,12 @@ public class Vala.GIRWriter : CodeVisitor {
                        buffer.append_printf ("<type name=\"gpointer\" c:type=\"%s\"/>\n", CCodeBaseModule.get_ccode_name (type));
                } else if (type.data_type != null) {
                        write_indent ();
-                       buffer.append_printf ("<type name=\"%s\" c:type=\"%s\"", gi_type_name (type.data_type), CCodeBaseModule.get_ccode_name (type));
+                       string type_name = gi_type_name (type.data_type);
+                       bool is_array = false;
+                       if ((type_name == "GLib.Array") || (type_name == "GLib.PtrArray")) {
+                               is_array = true;
+                       }
+                       buffer.append_printf ("<%s name=\"%s\" c:type=\"%s\"", is_array ? "array" : "type", gi_type_name (type.data_type), CCodeBaseModule.get_ccode_name (type));
 
                        List<DataType> type_arguments = type.get_type_arguments ();
                        if (type_arguments.size == 0) {
@@ -1284,7 +1289,7 @@ public class Vala.GIRWriter : CodeVisitor {
 
                                indent--;
                                write_indent ();
-                               buffer.append_printf ("</type>\n");
+                               buffer.append_printf ("</%s>\n", is_array ? "array" : "type");
                        }
                } else if (type is DelegateType) {
                        var deleg_type = (DelegateType) type;