]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Write has_type_id attribute for structs in VAPI files
authorJürg Billeter <j@bitron.ch>
Sun, 10 Jan 2010 19:49:06 +0000 (20:49 +0100)
committerJürg Billeter <j@bitron.ch>
Sat, 16 Jan 2010 19:35:59 +0000 (20:35 +0100)
Make sure we don't lose has_type_id if it's false.

Based on patch by Marc-André Lureau, fixes bug 606580.

vala/valacodewriter.vala

index e6dd8828f2842f2025f460823928faf26d1dc868..a23f05f996cb043e084aa0f029fbac40b7110d74 100644 (file)
@@ -320,17 +320,19 @@ public class Vala.CodeWriter : CodeVisitor {
                        write_string ("cname = \"%s\", ".printf (st.get_cname ()));
                }
 
-               if (!st.is_simple_type () && st.get_type_id () != "G_TYPE_POINTER") {
+               if (!st.has_type_id) {
+                       write_string ("has_type_id = false");
+               } else if (!st.is_simple_type () && st.get_type_id () != "G_TYPE_POINTER") {
                        write_string ("type_id = \"%s\", ".printf (st.get_type_id ()));
                }
 
-                if (!st.has_copy_function) {
-                        write_string ("has_copy_function = false, ");
-                }
+               if (!st.has_copy_function) {
+                       write_string ("has_copy_function = false, ");
+               }
 
-                if (!st.has_destroy_function) {
-                        write_string ("has_destroy_function = false, ");
-                }
+               if (!st.has_destroy_function) {
+                       write_string ("has_destroy_function = false, ");
+               }
 
                write_string ("cheader_filename = \"%s\")]".printf (get_cheaders(st)));
                write_newline ();
@@ -470,7 +472,7 @@ public class Vala.CodeWriter : CodeVisitor {
                write_string ("[CCode (cprefix = \"%s\", ".printf (en.get_cprefix ()));
 
                if (!en.has_type_id) {
-                       write_string ("has_type_id = \"%d\", ".printf (en.has_type_id ? 1 : 0));
+                       write_string ("has_type_id = false");
                }
 
                write_string ("cheader_filename = \"%s\")]".printf (get_cheaders(en)));